ITADN

UX: Better error handling if `replaces:` block needed, and hide help on error

#65OpenDentrax 创建于 2025-04-03
D
Dentraxcommented
Idea is to rephrase the following error to clarify a bit and show to further steps: * gobump should check if the package in the `replaces` block in the `go.mod` file, if so append a message something like: "Please put your package bump in the 'replaces:' block". * Hide show-help-on-error. It feels like there is a CLI usage error but actually there isn't. We should only show up the help if the CLI usage is wrong. ``` 2025/04/03 12:08:46 WARN Error: failed to run update. Error: package github.com/docker/docker with version 'v23.0.15+incompatible' is already at version v25.0.6+incompatible 2025/04/03 12:08:46 WARN Usage: 2025/04/03 12:08:46 WARN gobump [flags] 2025/04/03 12:08:46 WARN gobump [command] 2025/04/03 12:08:46 WARN 2025/04/03 12:08:46 WARN Available Commands: 2025/04/03 12:08:46 WARN completion Generate the autocompletion script for the specified shell 2025/04/03 12:08:46 WARN help Help about any command 2025/04/03 12:08:46 WARN version Prints the version 2025/04/03 12:08:46 WARN 2025/04/03 12:08:46 WARN Flags: 2025/04/03 12:08:46 WARN --bump-file string Filename containing the list of packages to update / replace 2025/04/03 12:08:46 WARN --compat string set the go version for which the tidied go.mod and go.sum files should be compatible 2025/04/03 12:08:46 WARN --go-version string set the go-version for go-mod-tidy 2025/04/03 12:08:46 WARN -h, --help help for gobump 2025/04/03 12:08:46 WARN --modroot string path to the go.mod root 2025/04/03 12:08:46 WARN --packages string A space-separated list of packages to update 2025/04/03 12:08:46 WARN --replaces string A space-separated list of packages to replace 2025/04/03 12:08:46 WARN --show-diff Show the difference between the original and 'go.mod' files 2025/04/03 12:08:46 WARN --skip-initial-tidy Skip running 'go mod tidy' command before updating the go.mod file 2025/04/03 12:08:46 WARN --tidy Run 'go mod tidy' command 2025/04/03 12:08:46 WARN 2025/04/03 12:08:46 WARN Use "gobump [command] --help" for more information about a command. 2025/04/03 12:08:46 WARN 2025/04/03 12:08:46 WARN 2025/04/03 12:08:46 failed to run update. Error: package github.com/docker/docker with version 'v23.0.15+incompatible' is already at version v25.0.6+incompatible ```
0 条评论