1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:24:42 -07:00
go/internal/lsp/testdata/diagnostics/bad/bad.go
Rebecca Stambler f7a8a58e8d internal/lsp: use packagestest markers to test diagnostics
Add some basic tests for diagnostics using the new
go/packages/packagestest framework.

Change-Id: I6a7bfba6c392928a9eb123ab71ceb73785c12600
Reviewed-on: https://go-review.googlesource.com/c/145697
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-11-02 21:57:01 +00:00

20 lines
336 B
Go

package bad
func stuff() {
x := "heeeeyyyy"
random2(x) //@diag("x", "cannot use x (variable of type string) as int value in argument to random2")
random2(1)
y := 3 //@diag("y", "y declared but not used")
}
type bob struct {
x int
}
func _() {
var q int
_ = &bob{
f: q, //@diag("f", "unknown field f in struct literal")
}
}