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

Improve dep update error message #2901

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

pkwarren
Copy link
Member

Update the error message shown with 'buf dep update' if there are unused dependencies.

Update the error message shown with 'buf dep update' if there are unused
dependencies.
@@ -92,8 +92,7 @@ func Prune(
switch t := malformedDep.Type(); t {
case bufworkspace.MalformedDepTypeUnused:
logger.Sugar().Warnf(
`Module %s is declared in your buf.yaml deps but is unused. This command only modifies buf.locks, not buf.yamls, please %s from your buf.yaml deps if it is not needed.`,
malformedDep.ModuleFullName(),
`Module %[1]s is declared in your buf.yaml deps but is unused. This command only modifies buf.lock files, not buf.yaml files. Please remove %[1]s from your buf.yaml deps if it is not needed.`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is it updating it to? Can you provide an example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:

$ buf dep update
WARN	Module buf.build/protocolbuffers/wellknowntypes is declared in your buf.yaml deps but is unused. This command only modifies buf.locks, not buf.yamls, please buf.build/protocolbuffers/wellknowntypes from your buf.yaml deps if it is not needed.

After:

$ buf dep update
WARN	Module buf.build/protocolbuffers/wellknowntypes is declared in your buf.yaml deps but is unused. This command only modifies buf.lock files, not buf.yaml files. Please remove buf.build/protocolbuffers/wellknowntypes from your buf.yaml deps if it is not needed.

The main change is to add remove after please.

@pkwarren pkwarren merged commit 3dae212 into bufmod Apr 19, 2024
10 checks passed
@pkwarren pkwarren deleted the pkw/improve-dep-update-error-message branch April 19, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants