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/tools/cmd/stringer: does not honor build tags #9449

Closed
olliebun opened this issue Dec 26, 2014 · 3 comments
Closed

x/tools/cmd/stringer: does not honor build tags #9449

olliebun opened this issue Dec 26, 2014 · 3 comments

Comments

@olliebun
Copy link

What does 'go version' print?

go version go1.4 linux/amd64

Additionally, stringer source is at this commit:

79d60d6

What steps reproduce the problem?

Create file A with // +build foo and file B with // +build bar which both declare a string like const BANG = "hello".

Build the package.

What happened?

go generate failed like this:

stringer: checking package: sql_sqlite.go:39:2: INSERT redeclared in this block
src/$package/main.go:35: running "stringer": exit status 1 

What should have happened instead?

The files using build tags have nothing to do with the code using //go:generate, so I expect stringer to work as designed.

@mikioh mikioh changed the title tools/cmd/stringer: fails if names are reused with conditional build tags cmd/stringer: fails if names are reused with conditional build tags Jan 4, 2015
@robpike robpike changed the title cmd/stringer: fails if names are reused with conditional build tags cmd/stringer: does not honor build tags Jan 6, 2015
@robpike
Copy link
Contributor

robpike commented Jan 6, 2015

Not obvious it should or should not honor tags, but it needs to be thought about. There are arguments both ways.

@robpike robpike self-assigned this Jan 6, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/stringer: does not honor build tags x/tools/cmd/stringer: does not honor build tags Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/121995 mentions this issue: stringer: add a -tags flag that supports build tags

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/122537 mentions this issue: cmd/stringer: add a -tags flag that supports build tags

gopherbot pushed a commit to golang/tools that referenced this issue Jul 10, 2018
This is reapplying CL121995 after rolling back the change to the importing
methods. There is still a need for a flag to control tags.
The original CL decription:

The feature has been requested but, like build tags in general,
only works in a directory, not when files are specified explicitly.
Unlike the build tools, report when the feature is misused like this
to avoid confusion.

Fixes golang/go#9449

Change-Id: I732627d5f2e6323367e3bdd5de746923868890a9
Reviewed-on: https://go-review.googlesource.com/122537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
SOF3 pushed a commit to SOF3/go-stringer-inverse that referenced this issue Aug 23, 2018
The feature has been requested but, like build tags in general,
only works in a directory, not when files are specified explicitly.
Unlike the build tools, report when the feature is misused like this
to avoid confusion.

Fixes golang/go#9449

Change-Id: I079d363c5eeb5bc647fd2f0f3d88d28d630644d8
Reviewed-on: https://go-review.googlesource.com/121995
Reviewed-by: Ian Lance Taylor <iant@golang.org>
SOF3 pushed a commit to SOF3/go-stringer-inverse that referenced this issue Aug 23, 2018
This is reapplying CL121995 after rolling back the change to the importing
methods. There is still a need for a flag to control tags.
The original CL decription:

The feature has been requested but, like build tags in general,
only works in a directory, not when files are specified explicitly.
Unlike the build tools, report when the feature is misused like this
to avoid confusion.

Fixes golang/go#9449

Change-Id: I732627d5f2e6323367e3bdd5de746923868890a9
Reviewed-on: https://go-review.googlesource.com/122537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
SOF3 pushed a commit to SOF3/go-stringer-inverse that referenced this issue Aug 23, 2018
The feature has been requested but, like build tags in general,
only works in a directory, not when files are specified explicitly.
Unlike the build tools, report when the feature is misused like this
to avoid confusion.

Fixes golang/go#9449

Change-Id: I079d363c5eeb5bc647fd2f0f3d88d28d630644d8
Reviewed-on: https://go-review.googlesource.com/121995
Reviewed-by: Ian Lance Taylor <iant@golang.org>
SOF3 pushed a commit to SOF3/go-stringer-inverse that referenced this issue Aug 23, 2018
This is reapplying CL121995 after rolling back the change to the importing
methods. There is still a need for a flag to control tags.
The original CL decription:

The feature has been requested but, like build tags in general,
only works in a directory, not when files are specified explicitly.
Unlike the build tools, report when the feature is misused like this
to avoid confusion.

Fixes golang/go#9449

Change-Id: I732627d5f2e6323367e3bdd5de746923868890a9
Reviewed-on: https://go-review.googlesource.com/122537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Jul 9, 2019
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants