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

x/text/cmd/gotext: panic: interface conversion: types.Type is nil, not *types.Signature #51865

Closed
thediveo opened this issue Mar 22, 2022 · 2 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@thediveo
Copy link

thediveo commented Mar 22, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18 linux/amd64

Does this issue reproduce with the latest release?

Yes, go1.18 is the latest version at the time of creating this issue ticket.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/harald/.cache/go-build"
GOENV="/home/harald/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/harald/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/harald/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/current"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/current/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/harald/github/lxkns/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4149794512=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import (
        "golang.org/x/text/language"
        "golang.org/x/text/message"
)

func main() {
        lang := language.MustParse("en-US")
        p := message.NewPrinter(lang)
        p.Printf("Wilkomen!\n")
}
$ go mod init test
$ go mod tidy
$ gotext update -out catalog.go test
panic: interface conversion: types.Type is nil, not *types.Signature

goroutine 669 [running]:
golang.org/x/tools/go/ssa.(*builder).expr0(0x7de520?, 0xc001c55680, {0x8d2cd8?, 0xc001fd9f60}, {0x0, {0x0, 0x0}, {0x0, 0x0}})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:679 +0x1f85
golang.org/x/tools/go/ssa.(*builder).expr(0x7dd740?, 0xc001c55680, {0x8d2cd8?, 0xc001fd9f60?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:530 +0x19f
golang.org/x/tools/go/ssa.(*builder).expr0(0x7de520?, 0xc001c55680, {0x8d2f78?, 0xc001fda2a0}, {0x2, {0x8d2088, 0xc001111280}, {0x0, 0x0}})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:697 +0x1abd
golang.org/x/tools/go/ssa.(*builder).expr(0x7dd740?, 0xc001c55680, {0x8d2f78?, 0xc001fda2a0?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:530 +0x19f
golang.org/x/tools/go/ssa.(*builder).setCallFunc(0x80?, 0xc001c55680?, 0xc001fc3e00?, 0xc00eda5440)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:881 +0x2ec
golang.org/x/tools/go/ssa.(*builder).setCall(0x7de520?, 0xc001c55680, 0xc001fc3e00, 0xc00eda5440)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:962 +0x31
golang.org/x/tools/go/ssa.(*builder).expr0(0x7de520?, 0xc001c55680, {0x8d29d8?, 0xc001fc3e00}, {0x7, {0x8d1f98, 0xc56a60}, {0x0, 0x0}})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:596 +0x1eae
golang.org/x/tools/go/ssa.(*builder).expr(0xc00c387d78?, 0xc001c55680, {0x8d29d8?, 0xc001fc3e00?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:530 +0x19f
golang.org/x/tools/go/ssa.(*builder).assign(0xc001c55680?, 0xc001c55680?, {0x8d3878?, 0xc00edb0c60}, {0x8d29d8?, 0xc001fc3e00?}, 0x0?, 0xc004a1d0c0)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:502 +0x3db
golang.org/x/tools/go/ssa.(*builder).assignStmt(0x203003?, 0xc001c55680, {0xc001fb5ed0, 0x1, 0x20?}, {0xc001fb5ef0, 0x1, 0xc0018a2820?}, 0x1)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:1050 +0x25d
golang.org/x/tools/go/ssa.(*builder).stmt(0x0?, 0xc001c55680, {0x8d2858?, 0xc001fc3e40?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2006 +0x1094
golang.org/x/tools/go/ssa.(*builder).stmtList(0x40ccfd?, 0x7f8a60?, {0xc001fc3f00?, 0x3, 0xc00edb40c0?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:790 +0x67
golang.org/x/tools/go/ssa.(*builder).stmt(0xc001c55680?, 0xc001c55680, {0x8d2978?, 0xc001fbdcb0?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2102 +0x1331
golang.org/x/tools/go/ssa.(*builder).stmt(0x0?, 0xc001c55680, {0x8d2d08?, 0xc001fc3f40?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2116 +0x17ec
golang.org/x/tools/go/ssa.(*builder).stmtList(0xc0018a2820?, 0x7f324c5b8e08?, {0xc001de4800?, 0x24, 0x203003?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:790 +0x67
golang.org/x/tools/go/ssa.(*builder).stmt(0xc001c55680?, 0xc001c55680, {0x8d2978?, 0xc001fe41e0?})
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2102 +0x1331
golang.org/x/tools/go/ssa.(*builder).buildFunction(0x7de9a0?, 0xc001c55680)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2195 +0x465
golang.org/x/tools/go/ssa.(*builder).buildFuncDecl(0x7de9a0?, 0xc00374b500, 0xc001fe4210)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2225 +0x154
golang.org/x/tools/go/ssa.(*Package).build(0xc00374b500)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2341 +0xd05
sync.(*Once).doSlow(0x626e60?, 0xc003b35a90?)
        /snap/go/9401/src/sync/once.go:68 +0xc2
sync.(*Once).Do(...)
        /snap/go/9401/src/sync/once.go:59
golang.org/x/tools/go/ssa.(*Package).Build(...)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2260
golang.org/x/tools/go/ssa.(*Program).Build.func1(0x45?)
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2244 +0x4c
created by golang.org/x/tools/go/ssa.(*Program).Build
        /home/harald/go/pkg/mod/golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e/go/ssa/builder.go:2243 +0x19c

What did you expect to see?

gotext to run successfully to completion without panic'king.

What did you see instead?

Go runtime panic: panic: interface conversion: types.Type is nil, not *types.Signature.

Suspicions?

As this works with go 1.17.x and only happens after upgrading to go 1.18 this panic might be related to the introduction of generics and thus changes/additions in the reflection data, et cetera.

@gopherbot gopherbot added this to the Unreleased milestone Mar 22, 2022
@seankhliao
Copy link
Member

Which version of gotext is this?
does it happen with a build from master?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 22, 2022
@thediveo
Copy link
Author

Ouch 😧 ... another case of @latest versus @master, it seems:

$ go install golang.org/x/text/cmd/gotext@master
go: downloading golang.org/x/text v0.3.8-0.20220124021120-d1c84af989ab
go: downloading golang.org/x/tools v0.1.7
$ gotext update -out catalog.go test
$ cat locales/en-US/out.gotext.json

    "language": "en-US",
    "messages": [
        {
            "id": "Wilkomen!",
            "message": "Wilkomen!",
            "translation": "Wilkomen!",
            "translatorComment": "Copied from source.",
            "fuzzy": true
        }
    ]
}

So this obviously has been fixed somewhere after latest and current HEAD. So I'm closing this.

@golang golang locked and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants