Skip to content

x/tools/stringer: stringer: no value for constant (for Go 1.23) #68882

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

Closed
olegrok opened this issue Aug 15, 2024 · 3 comments
Closed

x/tools/stringer: stringer: no value for constant (for Go 1.23) #68882

olegrok opened this issue Aug 15, 2024 · 3 comments
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@olegrok
Copy link

olegrok commented Aug 15, 2024

Go version

go version go1.23.0 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/oleg/.cache/go-build'
GOENV='/home/oleg/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/oleg/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/oleg/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/oleg/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.linux-amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/oleg/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.linux-amd64/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/oleg/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/oleg/Projects/toy-cluster/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1613584254=/tmp/go-build -gno-record-gcc-switches'

What did you do?

After I change go 1.22 to go 1.23 in my go.mod file I have following output

$ go install -a golang.org/x/tools/cmd/stringer@latest
$ stringer -type=MessageStatus -trimprefix=MessageStatus
stringer: no value for constant MessageStatusSuccess

In case if I rollback my changes it works fine:
$ git checkout -- ../../../go.mod
$ stringer -type=MessageStatus -trimprefix=MessageStatus

What did you see happen?

I have following code:

const (
	MessageStatusSuccess MessageStatus = iota
	// All codes below are considered as errors
        ...
)

type MessageStatus uint32

I run stringer with go 1.22 specified in go.mod and it works fine. After I change it to Go 1.23 it started to fail with unclear error.

What did you expect to see?

stringer works with go 1.23

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Aug 15, 2024
@gopherbot gopherbot added this to the Unreleased milestone Aug 15, 2024
@seankhliao
Copy link
Member

what's the go version you have outside of your module directory?
you may need to install stringer using go1 23

@olegrok
Copy link
Author

olegrok commented Aug 15, 2024

Yes. Probably you are right. Outside the module I sill used 1.22. It can be an issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants