Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues reported by golangci-lint #25

Closed
mewmew opened this issue May 26, 2018 · 0 comments
Closed

Fix issues reported by golangci-lint #25

mewmew opened this issue May 26, 2018 · 0 comments

Comments

@mewmew
Copy link
Member

mewmew commented May 26, 2018

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
	^
mewmew added a commit that referenced this issue May 27, 2018
frame/utf8.go:11:2: `t1` is unused (deadcode)
	t1 = 0x00 // 0000 0000

Updates #25.
mewmew added a commit that referenced this issue May 27, 2018
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 {
	                                ^

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[:])
				            ^

Updates #25.
mewmew added a commit that referenced this issue May 27, 2018
Fix issue reported by megacheck:

cmd/go-metaflac/metaflac.go:82:2: unnecessary nil check around range (megacheck)
	if blockNums != nil {
	^

Updates #25.
mewmew added a commit that referenced this issue May 27, 2018
Fixes lint issue reported by gocyclo:

frame/frame.go:212:1: cyclomatic complexity 52 of func `(*Frame).parseHeader` is high (> 30) (gocyclo)
func (frame *Frame) parseHeader() error {
^

Updates #25.
mewmew added a commit that referenced this issue May 27, 2018
Fixes lint issue reported by gocyclo:

meta/cuesheet.go:30:1: cyclomatic complexity 37 of func `(*Block).parseCueSheet` is high (> 30) (gocyclo)
func (block *Block) parseCueSheet() error {
^

Fixes #25.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant