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

     1  This test verifies that analyzers without RunDespiteErrors are not
     2  executed on a package containing type errors (see issue #54762).
     3  
     4  We require go1.18 because the range of the `1 + ""` go/types error
     5  changed then, and the new @diag marker is quite particular.
     6  
     7  -- go.mod --
     8  module example.com
     9  go 1.12
    10  
    11  -- a.go --
    12  package a
    13  
    14  func _() {
    15  	// A type error.
    16  	_ = 1 + "" //@diag(`1 + ""`, re"mismatched types|cannot convert")
    17  
    18  	// A violation of an analyzer for which RunDespiteErrors=false:
    19  	// no (simplifyrange, warning) diagnostic is produced; the diag
    20  	// comment is merely illustrative.
    21  	for _ = range "" { //diag("for _", "simplify range expression", )
    22  
    23  	}
    24  }