Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmd/gf): fix gen enums failed in go version v1.22.1 #3565

Merged
merged 6 commits into from
May 7, 2024

Conversation

oldme-git
Copy link
Member

@oldme-git oldme-git commented May 7, 2024

Dear reviewer:
因为 golang.org/x/tools 过低,和 Go 1.22.1 不兼容,导致 gf gen enums 失败。堆栈信息:

PS D:\project\gf\cmd\gf> go run .\main.go gen enums
scanning for enums: D:\project\gf\cmd\gf
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=0x153b8cf]

goroutine 490 [running]:
go/types.(*Checker).handleBailout(0xc000c42200, 0xc000047bd0)
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/check.go:367 +0x88
panic({0x19b2e40?, 0x28a30c0?})
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x1c76118, 0x28adee0})
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/sizes.go:333
go/types.representableConst.func1({0x1c76118?, 0x28adee0?})
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x1c79eb8, 0x27a62c0}, 0xc000c42200, 0x28adee0, 0xc000045fe8)
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc000c42200, 0xc00090d0c0, 0x28adee0)
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc000c42200, 0xc00090d0c0, {0x1c76118, 0x28adee0})
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).convertUntyped(0xc000c42200, 0xc00090d0c0, {0x1c76118, 0x28adee0})
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/go/types/const.go:289 +0x3f
go/types.(*Checker).matchTypes(0xc000c42200, 0xc00090d080, 0xc00090d0c0)
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        C:/Users/half/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
        C:/Users/half/go/pkg/mod/golang.org/x/tools@v0.7.0/go/packages/packages.go:839 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
        C:/Users/half/go/pkg/mod/golang.org/x/tools@v0.7.0/go/packages/packages.go:846 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 482
        C:/Users/half/go/pkg/mod/golang.org/x/tools@v0.7.0/go/packages/packages.go:845 +0x94
exit status 2

Fixes #3564

@gqcn gqcn changed the title cmd/gf: fix gen enums fail cmd/gf: fix gen enums fail in go version v1.22.1 May 7, 2024
@gqcn gqcn changed the title cmd/gf: fix gen enums fail in go version v1.22.1 cmd/gf: fix gen enums failed in go version v1.22.1 May 7, 2024
@gqcn gqcn merged commit ff28d88 into gogf:master May 7, 2024
23 checks passed
@oldme-git oldme-git deleted the fix/#3564 branch May 9, 2024 01:27
@gqcn gqcn changed the title cmd/gf: fix gen enums failed in go version v1.22.1 fix(cmd/gf): fix gen enums failed in go version v1.22.1 Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmd/gf: gen enums fail
2 participants