Skip to content

Commit

Permalink
Merge pull request #24 from nao1215/improvement-error-msg
Browse files Browse the repository at this point in the history
Improved error messages
  • Loading branch information
nao1215 authored Apr 16, 2022
2 parents c795a04 + fd94fd6 commit ef0f6fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. The format
## Changed
- Parallelized update process
- Simplified messages during the update process
- Improved error messages
# [0.9.1] - 2022-03-19
## Changed
- Changed the message at the time of update was incorrect, so the message was corrected.
Expand Down
4 changes: 2 additions & 2 deletions cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ func update(pkgs []goutil.Package, dryRun bool) int {
updater := func(p goutil.Package, result chan updateResult) {
var err error
if p.ImportPath == "" {
err = fmt.Errorf(" %s", p.Name)
err = fmt.Errorf(" %s is not installed by 'go install' (or permission incorrect)", p.Name)
} else {
if err = goutil.Install(p.ImportPath); err != nil {
err = fmt.Errorf(" %w: %s", err, p.Name)
err = fmt.Errorf(" %s %w", p.Name, err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/goutil/goutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ func CanUseGoCmd() error {
// Install execute "$ go install <importPath>@latest"
func Install(importPath string) error {
if importPath == "command-line-arguments" {
return errors.New("this is devel-binary copied from local environment")
return errors.New("is devel-binary copied from local environment")
}
if err := exec.Command("go", "install", importPath+"@latest").Run(); err != nil {
return errors.New("can't install " + importPath)
return fmt.Errorf("can't install %s: %w", importPath, err)
}
return nil
}
Expand Down

0 comments on commit ef0f6fa

Please sign in to comment.