diff --git a/go.mod b/go.mod index 43fdeb7b..7401e04d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module honnef.co/go/tools go 1.22 require ( - github.com/BurntSushi/toml v1.3.2 + github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678 golang.org/x/sys v0.20.0 diff --git a/go.sum b/go.sum index 9f326b9d..af667b21 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678 h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ= diff --git a/go/loader/loader.go b/go/loader/loader.go index f1f8d1d7..1fb76368 100644 --- a/go/loader/loader.go +++ b/go/loader/loader.go @@ -336,7 +336,7 @@ func convertError(err error) []packages.Error { case config.ParseError: errs = append(errs, packages.Error{ - Pos: fmt.Sprintf("%s:%d", err.Filename, err.Position.Line), + Pos: fmt.Sprintf("%s:%d:%d", err.Filename, err.Position.Line, err.Position.Col), Msg: fmt.Sprintf("%s (last key parsed: %q)", err.Message, err.LastKey), Kind: packages.ParseError, }) diff --git a/lintcmd/lint.go b/lintcmd/lint.go index a617c702..3168389e 100644 --- a/lintcmd/lint.go +++ b/lintcmd/lint.go @@ -429,6 +429,11 @@ func failed(res runner.Result) []diagnostic { msg = msg[1:] } + cat := "compile" + if e.Kind == packages.ParseError { + cat = "config" + } + var posn token.Position if e.Pos == "" { // Under certain conditions (malformed package @@ -456,7 +461,7 @@ func failed(res runner.Result) []diagnostic { Diagnostic: runner.Diagnostic{ Position: posn, Message: msg, - Category: "compile", + Category: cat, }, Severity: severityError, }