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
Comments
Agreed, It may be as simple as adding an error check in this loop: |
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: |
Add check for package loader to print error and fail `go generate` command, if package can not be found. Fixes golang#60079
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
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
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
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 Maybe this change in behavior should be documented in the release notes? |
I don't think this is a big enough change in behavior to merit a release note |
@matloob It is a breaking changes in an API that breaks use cases downstream (nixpkgs in my case). How can that not be enough to be mentioned in the release notes? |
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: