Skip to content

Analyzer: called is a analyzer which can find function calling

License

Notifications You must be signed in to change notification settings

gostaticanalysis/called

Repository files navigation

called

pkg.go.dev

called called find callings specified by called.funcs flag.

package main

import "log"

func main() {
	log.Fatal("hoge")
}
$ go vet -vettool=`which called` -called.funcs="log.Fatal" main.go
./main.go:6:11: log.Fatal must not be called

Ignore Checks

Analyzers ignore nodes which are annotated by staticcheck's style comments as belows. A ignore comment includes analyzer names and reason of ignoring checking. If you specify called as analyzer name, all analyzers ignore corresponding code.

package main

import "log"

func main() {
	//lint:ignore called reason
	log.Fatal("hoge")
}