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" appears to be a silent no-op when given a missing package #60079
Labels
GoCommand
cmd/go
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Comments
Agreed, It may be as simple as adding an error check in this loop: |
g4s8
added a commit
to g4s8/go
that referenced
this issue
May 13, 2023
Add check for package loader to print error and fail `go generate` command, if package can not be found. Fixes golang#60079
Change https://go.dev/cl/494836 mentions this issue: |
g4s8
added a commit
to g4s8/go
that referenced
this issue
May 17, 2023
Add check for package loader to print error and fail `go generate` command, if package can not be found. Fixes golang#60079
g4s8
added a commit
to g4s8/go
that referenced
this issue
May 24, 2023
Add check for package loader to print error and fail `go generate` command, if package no go files in package or specified import doesn't exist. Fixes golang#60079
g4s8
added a commit
to g4s8/go
that referenced
this issue
May 25, 2023
Add check for package loader to print error and fail `go generate` command, if package no go files in package or specified import doesn't exist. Fixes golang#60079
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
GoCommand
cmd/go
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes; appears to happen with 1.20.4 as well.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Both commands should fail on a missing package.
What did you see instead?
go generate
appears to happily do nothing.It could be due to its nature of working with broken packages, for example if the generated files are required for the package to typecheck but they are missing. However, if the package can't be located at all, that should clearly be an error. I had a weird issue at work where I thought my generator wasn't working, simply because I was making a typo when writing
go generate ./some/pkg
.The text was updated successfully, but these errors were encountered: