debugcode

debugcode finds debug codes.

  • builtinprint: finds calling builtin print or println.
  • commentout: finds a commented out debug code without reason

Install

You can get debugcode by go install command (Go 1.16 and higher).

$ go install github.com/gostaticanalysis/[email protected]

How to use

debugcode run with go vet as below when Go is 1.12 and higher.

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

Analyzers

builtinprint

See: https://github.com/gostaticanalysis/builtinprint

commentout

commentout: finds a commented out debug code without reason.

package a

//func f() { // want "do not leave a commented out debug code without reason"
//	panic("not implement")
//}

// with reason // OK
//func f() {
//	panic("not implement")
//}

Analyze with golang.org/x/tools/go/analysis

You can get analyzers of debugcode from debugcode.Analyzers. And you can use them with unitchecker.

GitHub

https://github.com/gostaticanalysis/debugcode