go installで導入したパッケージをgupで最新にする

cargo-update 🏛️コマンドが便利なのでGo環境でも同じようなものを探してみました.gupというものを見つけて試してみました.

gupのインストール
$ go install github.com/nao1215/gup@latest
Note
releases 🏛️にはいくつかの形式のパッケージやバイナリもあります.
$GOPATH/bin のリストを取得
$ gup list
             air: github.com/cosmtrek/air@v1.44.0
           algia: github.com/mattn/algia@v0.0.83
       bluetuith: github.com/darkhz/bluetuith@v0.2.3
            bsky: github.com/mattn/bsky@v0.0.61
              : (以下省略)
バイナリが最新バージョンかチェックする
$ gup check
check binary under $GOPATH/bin or $GOBIN
[ 1/22] libdb.so/dissent (v0.0.30 / current: go1.22.6, installed: go1.23.2)
[ 2/22] github.com/thushan/smash (Already up-to-date: v0.9.3 / go1.23.2)
[ 3/22] github.com/mrmarble/termsvg/cmd/termsvg (Already up-to-date: v0.9.2 / go1.23.2)
[ 4/22] github.com/darkhz/bluetuith (Already up-to-date: v0.2.3 / go1.23.2)
[ 5/22] github.com/nao1215/gup (Already up-to-date: v0.27.5 / go1.23.2)
[ 6/22] github.com/pouriyajamshidi/tcping (Already up-to-date: v1.22.1 / go1.23.2)
[ 7/22] github.com/charmbracelet/glow (Already up-to-date: v1.5.1 / go1.23.2)
[ 8/22] github.com/schachmat/wego (Already up-to-date: v0.0.0-20241006164746-6578d5ebf3d5 / go1.23.2)
[ 9/22] github.com/mattn/bsky (Already up-to-date: v0.0.61 / go1.23.2)
[10/22] github.com/antonmedv/countdown (Already up-to-date: v1.5.0 / go1.23.2)
[11/22] github.com/BuddhiLW/lazywal/cmd/lazywal (Already up-to-date: v0.5.3 / go1.23.2)
[12/22] github.com/mattn/efm-langserver (Already up-to-date: v0.0.53 / go1.23.2)
[13/22] github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html (Already up-to-date: v3.16.3 / go1.23.2)
[14/22] github.com/diamondburned/gtkcord4 (current: v0.0.19, latest: v0.0.30 / current: go1.21.6, installed: go1.23.2)
[15/22] github.com/ariasmn/ugm (Already up-to-date: v1.6.0 / go1.23.2)
[16/22] github.com/charmbracelet/vhs (Already up-to-date: v0.8.0 / go1.23.2)
[17/22] github.com/mattn/algia (Already up-to-date: v0.0.83 / go1.23.2)
[18/22] github.com/cosmtrek/air (current: v1.44.0, latest: v1.61.1 / current: go1.19.8, installed: go1.23.2)
[19/22] github.com/sweetbbak/tget (current: v0.0.0-20240308040335-76c53b4462e7, latest: v0.1.1 / current: go1.22.1, installed: go1.23.2)
[20/22] github.com/kkdai/chatgpt (Already up-to-date: v0.4.1 / go1.23.2)
[21/22] github.com/pcarrier/vanity-keygen (Already up-to-date: v0.0.0-20220703224004-4dfc327cc534 / go1.23.2)
[22/22] github.com/eeeXun/gtt (Already up-to-date: v0.0.0-20240810151233-9986dcb52543 / go1.23.2)

If you want to update binaries, run the following command.
           $ gup update dissent gtkcord4 air tget
指定したバイナリを更新する
$ gup update tget
全てのバイナリを更新する
$ gup update
指定したバイナリを削除する
$ gup remove gtkcord4
Note
バイナリだけの削除のようでsourceは残ります.

GOバイナリ環境のエクスポート,インポート

GOバイナリ環境の情報をエクスポートして別環境にインポートできます.エクスポートファイルは $XDG_CONFIG_HOME/gup/gup.conf に書き出されます.もしくは --output オプションでSTDOUTに出力できます.

エクスポート
$ gup export
Export /home/matoken/.config/gup/gup.conf
$ tail -1 ~/.config/gup/gup.conf
wego = github.com/schachmat/wego
インポート
$ export GOPATH=$HOME/go-test (1)
$ export PATH=$PATH:$GOPATH/bin
$ go install github.com/nao1215/gup@latest (2)
$ which gup
/home/matoken/go-test/bin/gup
$ gup list (3)
gup: github.com/nao1215/gup@v0.27.5
$ rsync -avcP 192.168.0.27:~/.config/gup/gup.conf ~/.config/gup/ (4)
$ gup import (5)
start update based on /home/matoken/.config/gup/gup.conf
update binary under $GOPATH/bin or $GOBIN
[ 1/21] github.com/nao1215/gup (<from gup.conf> to v0.27.5, <from gup.conf> to )
[ 2/21] github.com/schachmat/wego (<from gup.conf> to v0.0.0-20241006164746-6578d5ebf3d5, <from gup.conf> to )
[ 3/21] github.com/mattn/algia (<from gup.conf> to v0.0.83, <from gup.conf> to )
[ 4/21] github.com/pouriyajamshidi/tcping (<from gup.conf> to v1.22.1, <from gup.conf> to )
          : (以下省略)
  1. テスト用の環境をGOPATHに設定

  2. gupを導入

  3. gupしか導入されていないのを確認

  4. リモートのgup.confをコピー

  5. インポート

Tip
Debian sid amd64環境でエクスポート,RaspberryPi OS armhf環境でインポートを試みましたがうまく行きました.

gup update で目的は達成できましたが,エクスポート,インポート機能がことのほか便利な感じです.

試した環境

メイン環境
$ gup list | grep gup
             gup: github.com/nao1215/gup@v0.27.5
$ dpkg-query -W golang
golang:amd64    2:1.23~2
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
インポート環境
$ gup list | grep gup
        gup: github.com/nao1215/gup@v0.27.5
$ dpkg-query -W golang
golang:armhf    2:1.19~1
$ lsb_release -dr
No LSB modules are available.
Description:    Raspbian GNU/Linux 12 (bookworm)
Release:        12
$ arch
armv7l

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)