dominikh / go-tools

Staticcheck - The advanced Go linter
https://staticcheck.dev
MIT License
6.01k stars 361 forks source link

location not reported properly by json formatter #1532

Closed nalbion closed 2 months ago

nalbion commented 2 months ago
$ staticcheck --version
staticcheck 2023.1.7 (v0.4.7)

$ go version
go version go1.22.2 linux/amd64

$ staticcheck -f json  data/test-invalid-syntax/invalid-imports.go

{
  "code":"compile",
  "severity":"error",
  "location":{
    "file":"",
    "line":0,
    "column":0
    },
    "end":{
      "file":"",
      "line":0,
      "column":0
    },
    "message":
      # command-line-arguments
      data/test-invalid-syntax/invalid-imports.go:10:2: syntax error: unexpected import, expected }
      data/test-invalid-syntax/invalid-imports.go:17:73: method has multiple receivers
      data/test-invalid-syntax/invalid-imports.go:17:73: syntax error: unexpected {, expected name
      data/test-invalid-syntax/invalid-imports.go:45:3: syntax error: unexpected ) after top level declaration"}
dominikh commented 2 months ago

That is output from the Go compiler, not diagnostics created by Staticcheck. That is, we're just passing through stderr here. I don't plan on doing any processing on that.