Skip to content

replu/slicenilcmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slicenilcmp

slicenilcmp detects comparisons between slice and nil.

func f() {
	var basicSlice []int
	if basicSlice == nil { // want "suggestion: use len func for empty check"
		print(basicSlice)
	}

	if len(basicSlice) == 0 { // ok
		print(basicSlice)
	}
}

Install

$ go install github.com/replu/slicenilcmp/cmd/slicenilcmp@latest

How to use

$ go vet -vettool=$(which slicenilcmp) ./...

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages