golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/format/issue59554.txt (about) 1 Test case for golang/go#59554: data corruption on formatting due to line 2 directives. 3 4 Note that gofumpt is needed for this test case, as it reformats var decls into 5 short var decls. 6 7 Note that gofumpt requires Go 1.20. 8 9 -- flags -- 10 -min_go=go1.20 11 12 -- settings.json -- 13 { 14 "formatting.gofumpt": true 15 } 16 17 -- main.go -- 18 package main //@format(main) 19 20 func Match(data []byte) int { 21 //line :1 22 var idx = ^uint(0) 23 _ = idx 24 return -1 25 } 26 -- @main -- 27 package main //@format(main) 28 29 func Match(data []byte) int { 30 //line :1 31 idx := ^uint(0) 32 _ = idx 33 return -1 34 }