I am aware of shadowing checks from govet but I am looking for something more specific. I am looking for a golangci-lint plugin that allows us to force local variables on specific functions. Ideally, something like this would fail my linter check:
package main
import (
"fmt"
)
var myglobalvar = "hello from global"
func testme(i string, j bool) {
fmt.Println(i)
}
func main() {
fmt.Printf("Hello, Golang\n")
mylocalvar := "hello from local"
testme(mylocalvar) // linter passes here
testme(myglobalvar) // linter fails here
}
I have searched over on https://golangci-lint.run/usage/linters/ but only shadowing seems close. It's possible that I do not know the language/keywords around this interaction.