microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
323 stars 56 forks source link

Update golang.org/x/tools to v0.18.0 #513

Closed qmuntal closed 4 months ago

qmuntal commented 4 months ago

This PR updates golang/x/tools by running go get golang.org/x/tools@latest.

This solve a panic when running go test -run TestImports ./pkg/sqlcmd-linter with the a Go 1.22 toolchain:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x43ad7e]

goroutine 68 [running]:
go/types.(*Checker).handleBailout(0xc00041a200, 0xc0001f1bd0)
        C:/Program Files/Go/src/go/types/check.go:367 +0x88
panic({0x4ebde0?, 0x740770?})
        C:/Program Files/Go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x5a8508, 0x743ae0})
        C:/Program Files/Go/src/go/types/sizes.go:228 +0x31e
go/types.(*Config).sizeof(...)
        C:/Program Files/Go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x5a8508?, 0x743ae0?})
        C:/Program Files/Go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x5a9878, 0x737c48}, 0xc00041a200, 0x743ae0, 0xc0001f13c0)
        C:/Program Files/Go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc00041a200, 0xc000074080, 0x743ae0)
        C:/Program Files/Go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc00041a200, 0xc000074080, {0x5a8508, 0x743ae0})
        C:/Program Files/Go/src/go/types/expr.go:375 +0x30d
go/types.(*Checker).assignment(0xc00041a200, 0xc000074080, {0x5a8508, 0x743ae0}, {0x53b640, 0x14})
        C:/Program Files/Go/src/go/types/assignments.go:52 +0x2e5
go/types.(*Checker).initVar(0xc00041a200, 0xc00010e240, 0xc000074080, {0x53b640, 0x14})
        C:/Program Files/Go/src/go/types/assignments.go:163 +0x41e
go/types.(*Checker).varDecl(0xc00041a200, 0xc00010e240, {0xc000112028, 0x1, 0x1}, {0x0, 0x0}, {0x5a8950, 0xc000238080})
        C:/Program Files/Go/src/go/types/decl.go:522 +0x19b
go/types.(*Checker).objDecl(0xc00041a200, {0x5ac038, 0xc00010e240}, 0x0)
        C:/Program Files/Go/src/go/types/decl.go:194 +0x9e5
go/types.(*Checker).packageObjects(0xc00041a200)
        C:/Program Files/Go/src/go/types/resolver.go:693 +0x4dd
go/types.(*Checker).checkFiles(0xc00041a200, {0xc000386008, 0x1, 0x1})
        C:/Program Files/Go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
        C:/Program Files/Go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc000236000, 0xc0005ca150)
        C:/Users/qmuntaldiaz/go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:1052 +0xa72
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        C:/Users/qmuntaldiaz/go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:851 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
        C:/Program Files/Go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        C:/Program Files/Go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
        C:/Users/qmuntaldiaz/go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:839 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
        C:/Users/qmuntaldiaz/go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:846 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 11
        C:/Users/qmuntaldiaz/go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:845 +0x94
FAIL    github.com/microsoft/go-sqlcmd/pkg/sqlcmd-linter        1.832s
FAIL
shueybubbles commented 4 months ago

@qmuntal if msft Go folks want to be a contributor to our projects, is there a Github team I can add? it'd save you from having to fork.

qmuntal commented 4 months ago

@qmuntal if msft Go folks want to be a contributor to our projects, is there a Github team I can add? it'd save you from having to fork.

Yep, this is the team: https://github.com/orgs/microsoft/teams/golang-compiler. We are not using go-sqlcmd directly, but we plan to use it to verify that the MSFT Go toolchain doesn't break compat with upstream.

shueybubbles commented 4 months ago

pls run build\build to update the NOTICE too