Debian Codegraph @

gopls/internal/test/marker/testdata/mcptools/workspace_diagnostics.txt

raw
1 This test exercises the "go_diagnostics" MCP tool.
2
3 -- flags --
4 -mcp
5 -ignore_extra_diags
6
7 -- go.mod --
8 module example.com
9
10 go 1.21
11
12 //@mcptool("go_diagnostics", `{"files":["$WORKDIR/a/a.go"]}`, output=diagnostics)
13 //@mcptool("go_diagnostics", `{"files":["$WORKDIR/b/b.go"]}`, output=diagnostics)
14 //@mcptool("go_diagnostics", `{"files":["$WORKDIR/main.go"]}`, output=diagnostics)
15 //@mcptool("go_diagnostics", `{"files":["$WORKDIR/b/b2.go", "$WORKDIR/main.go"]}`, output=diagnostics)
16 //@mcptool("go_diagnostics", `{"files":["$WORKDIR/main.go", "$WORKDIR/a/a.go"]}`, output=diagnostics)
17 //@mcptool("go_diagnostics", `{"files":["$WORKDIR/main.go", "$WORKDIR/a/a.go", "$WORKDIR/c/c.go"]}`, output=diagnostics_c)
18
19 -- main.go --
20 package main
21
22 import (
23 "example.com/a"
24 "example.com/b"
25 )
26
27 func main() int {
28 a.Print(b.B)
29 return 0
30 }
31
32 -- a/a.go --
33 package a
34
35 func Print(x string) {
36 println(x)
37 }
38
39 -- b/b.go --
40 package b
41
42 const B = 1
43
44 -- b/b2.go --
45
46 const B = 2
47
48 -- c/c.go --
49 package c
50
51 func _() {
52 var x interface{}
53 _ = x
54 }
55
56 -- @diagnostics --
57 File `$WORKDIR/b/b2.go` has the following diagnostics:
58 1:0-1:0: [Error] expected 'package', found 'const'
59
60 File `$WORKDIR/main.go` has the following diagnostics:
61 7:5-7:9: [Error] func main must have no arguments and no return values
62 8:9-8:12: [Error] cannot use b.B (untyped int constant 1) as string value in argument to a.Print
63
64 -- @diagnostics_c --
65 File `$WORKDIR/b/b2.go` has the following diagnostics:
66 1:0-1:0: [Error] expected 'package', found 'const'
67
68 File `$WORKDIR/c/c.go` has the following diagnostics:
69 3:7-3:18: [Hint] interface{} can be replaced by any
70 Fix:
71 --- $WORKDIR/c/c.go
72 +++ $WORKDIR/c/c.go
73 @@ -1,7 +1,7 @@
74 package c
75
76 func _() {
77 - var x interface{}
78 + var x any
79 _ = x
80 }
81
82
83
84
85 File `$WORKDIR/main.go` has the following diagnostics:
86 7:5-7:9: [Error] func main must have no arguments and no return values
87 8:9-8:12: [Error] cannot use b.B (untyped int constant 1) as string value in argument to a.Print
88