logginghandler/vendor/github.com/sonatard/noctx/reqwithoutctx/report.go
Marvin Preuss d095180eb4
All checks were successful
continuous-integration/drone/push Build is passing
build: uses go modules for tool handling
2022-01-14 13:51:56 +01:00

27 lines
491 B
Go

package reqwithoutctx
import (
"go/token"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/ssa"
)
type Report struct {
Instruction ssa.Instruction
}
func (n *Report) Pos() token.Pos {
return n.Instruction.Pos()
}
func (n *Report) Message() string {
return "should rewrite http.NewRequestWithContext or add (*Request).WithContext"
}
func report(pass *analysis.Pass, reports []*Report) {
for _, report := range reports {
pass.Reportf(report.Pos(), report.Message())
}
}