1
0
mirror of https://github.com/golang/go synced 2024-11-19 08:04:40 -07:00
go/internal/lsp/testdata/analyzer/bad_test.go
Michael Matloob e3efbe408c go/analysis: rename reportNodef to ReportRangef
This adds (or makes exported) a convenience function for reporting diagnostics with a
node directly (which is what folks usually want).

Change-Id: Ieb7ef2703f99d3a24ba7e48a779be62a7761cd0c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/180237
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-28 19:16:33 +00:00

19 lines
502 B
Go

package analyzer
import (
"fmt"
"sync"
"testing"
)
func Testbad(t *testing.T) { //@diag("", "tests", "Testbad has malformed name: first letter after 'Test' must not be lowercase")
var x sync.Mutex
_ = x //@diag("x", "copylocks", "assignment copies lock value to _: sync.Mutex")
printfWrapper("%s") //@diag(re`printfWrapper\(.*\)`, "printf", "printfWrapper format %s reads arg #1, but call has 0 args")
}
func printfWrapper(format string, args ...interface{}) {
fmt.Printf(format, args...)
}