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

cmd/go: go generate fails silently when run on a package in a nested workspace module #56098

Open
findleyr opened this issue Oct 7, 2022 · 2 comments
Labels
GoCommand cmd/go help wanted modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Oct 7, 2022

I noticed the following while working on https://go.dev/cl/440181. I have a go.work file using both x/tools and x/tools/gopls. When running go generate on a package in x/tools/gopls, the command exits with status 0 without doing anything.

When run from the gopls module, the go generate command works as expected. This can be seen from the following shell history, where I start from a clean workspace (at patchset 2 of the above CL), make an arbitrary edit in one of the generated files, and run go generate expecting it to revert the diff.

$ git status
On branch accessdenied
Your branch is ahead of 'origin/master' by 1 commit.

nothing to commit, working tree clean
$ echo "// arbitrary edit" >> gopls/internal/robustio/robustio.go
$ git status
On branch accessdenied
Your branch is ahead of 'origin/master' by 1 commit.

Changes not staged for commit:
        modified:   gopls/internal/robustio/robustio.go

no changes added to commit
$ go generate ./gopls/internal/robustio
$ echo $?
0
$ git status
On branch accessdenied
Your branch is ahead of 'origin/master' by 1 commit.

Changes not staged for commit:
        modified:   gopls/internal/robustio/robustio.go

no changes added to commit
$ cd gopls && go generate ./internal/robustio
$ git status
On branch accessdenied
Your branch is ahead of 'origin/master' by 1 commit.

nothing to commit, working tree clean
@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules GoCommand cmd/go labels Oct 7, 2022
@bcmills bcmills added this to the Backlog milestone Oct 7, 2022
@bcmills
Copy link
Member

bcmills commented Oct 7, 2022

Duplicate of #29751

@bcmills bcmills marked this as a duplicate of #29751 Oct 7, 2022
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2022
@bcmills
Copy link
Member

bcmills commented Oct 7, 2022

Hmm, not quite a duplicate (because of workspace mode). But #29751 is definitely closely related.

@bcmills bcmills reopened this Oct 7, 2022
@bcmills bcmills marked this as not a duplicate of #29751 Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go help wanted modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants