go-global-update

command module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 11 Imported by: 0

README

go-global-update

go-global-update screenshot

Update globally installed go binaries.

The missing go command similar to npm -g update or cargo install-update.

Table of contents

Requirements

  • Go 1.16 or higher

Installation

go install github.com/Gelio/go-global-update@latest

Usage

Running

go-global-update

will print information about currently installed global binaries and attempt to upgrade those that have newer versions.

You can also do a dry run without update the binaries:

go-global-update --dry-run

or update just a handful of binaries:

go-global-update gofumpt

For more information, see

go-global-update --help

Upgrading go-global-update

go-global-update will take care of updating itself when it updates other binaries.

Troubleshooting

Do you have problems updating some binaries using go-global-update? Take a look at TROUBLESHOOTING.md for more information.

How it works

go-global-update consists of the following steps:

  1. Determine binaries to inspect.

    Either use the list of provided arguments or all executables installed in your go env GOBIN (or $(go env GOPATH)/bin).

  2. Inspect where each executable came from (by running go version -m [executable name] and checking the path),

  3. Check the latest version for each binary using go list -m -f "{{.Version}}" [path]

  4. If the binary has a newer version, run go install [package path]@latest to update it.

Alternative tools

go-global-update is not the only tool trying to solve the problem of updating globally-installed go binaries. The alternatives are:

  • gup

    Advantages:

    • includes desktop notifications
    • has a subcommand to remove a binary
    • has a way to export/import a list of binaries

    Disadvantages:

    • does not offer troubleshooting information when an upgrade fails
    • does not report error logs from failed updates
    • updates binaries installed from source (potentially overwrites locally-made changes)
  • binstale

    Disadvantages:

    • seems not to detect globally-installed binaries using go modules

      $ binstale
      binstale
           (no source package found)
      go-global-update
           stale: github.com/Gelio/go-global-update (stale dependency: github.com/Gelio/go-global-update/internal/colors)
      gofumpt
           (no source package found)
      gotop
           (no source package found)
      misspell
           (no source package found)
      shfmt
      

Contributing

Contributions are welcome! See CONTRIBUTING.md for more information.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL