Categorygithub.com/amit-davidson/ArgOverwritten
repository
0.0.0-20221005113916-88aac54c1048
Repository: https://github.com/amit-davidson/argoverwritten.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

ArgOverwritten

made-with-Go made-with-Go MIT license PRs Welcome

ArgOverwritten finds function arguments being overwritten. Check out my blog post on writing the analyzer!

Quick Start:

Download the package

go get github.com/amit-davidson/ArgOverwritten/cmd/argoverwritten

Pass the entry point

go vet -vettool=$(which argoverwritten) ${path_to_file}

Example:

package testdata

func body(a int) {
	_ = func() {
		a = 5
	}
}

func main() {
	body(5)
}
go vet -vettool=$(which argoverwritten) /testdata/OverwritingParamFromOuterScope

Output

/testdata/OverwritingParamFromOuterScope/main.go:5:3: "a" overwrites func parameter