Fix issues reported by golangci-lint
mewmew opened this issue · 0 comments
mewmew commented
I started a branch to make use of golangci-lint. Currently it reports the following issues:
https://travis-ci.org/mewkiz/flac/builds/384037888
u@x220 ~/D/g/s/g/m/flac> golangci-lint run --enable-all
frame/frame.go:212:1: cyclomatic complexity 52 of func `(*Frame).parseHeader` is high (> 30) (gocyclo)
func (frame *Frame) parseHeader() error {
^
meta/cuesheet.go:30:1: cyclomatic complexity 37 of func `(*Block).parseCueSheet` is high (> 30) (gocyclo)
func (block *Block) parseCueSheet() error {
^
meta/streaminfo.go:4: G501: Blacklisted import crypto/md5: weak cryptographic primitive (gas)
"crypto/md5"
enc.go:178:35: unnecessary conversion (unconvert)
if err := enc.bw.WriteBits(uint64(si.NSamples), 36); err != nil {
^
enc.go:543:34: unnecessary conversion (unconvert)
if _, err := enc.bw.Write([]byte(pic.Data)); err != nil {
^
meta/cuesheet.go:204:20: struct of size 64 bytes could be of size 56 bytes (maligned)
type CueSheetTrack struct {
^
meta/meta.go:122:13: struct of size 24 bytes could be of size 16 bytes (maligned)
type Header struct {
^
cmd/go-metaflac/metaflac.go:82:2: unnecessary nil check around range (megacheck)
if blockNums != nil {
^
frame/frame.go:161:17: Error return value of `md5sum.Write` is not checked (errcheck)
md5sum.Write(buf[:1])
^
frame/frame.go:165:17: Error return value of `md5sum.Write` is not checked (errcheck)
md5sum.Write(buf[:2])
^
frame/frame.go:170:17: Error return value of `md5sum.Write` is not checked (errcheck)
md5sum.Write(buf[:])
^
frame/utf8.go:11:2: `t1` is unused (varcheck)
t1 = 0x00 // 0000 0000
^