golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/suggestedfix/undeclared.txt (about)

     1  Tests of suggested fixes for "undeclared name" diagnostics,
     2  which are of ("compiler", "error") type.
     3  
     4  -- go.mod --
     5  module example.com
     6  go 1.12
     7  
     8  -- a.go --
     9  package p
    10  
    11  func a() {
    12  	z, _ := 1+y, 11 //@suggestedfix("y", re"(undeclared name|undefined): y", a)
    13  	_ = z
    14  }
    15  
    16  -- @a/a.go --
    17  @@ -4 +4 @@
    18  +	y := 
    19  -- b.go --
    20  package p
    21  
    22  func b() {
    23  	if 100 < 90 {
    24  	} else if 100 > n+2 { //@suggestedfix("n", re"(undeclared name|undefined): n", b)
    25  	}
    26  }
    27  
    28  -- @b/b.go --
    29  @@ -4 +4 @@
    30  +	n := 
    31  -- c.go --
    32  package p
    33  
    34  func c() {
    35  	for i < 200 { //@suggestedfix("i", re"(undeclared name|undefined): i", c)
    36  	}
    37  	r() //@diag("r", re"(undeclared name|undefined): r")
    38  }
    39  
    40  -- @c/c.go --
    41  @@ -4 +4 @@
    42  +	i :=