refactor(go): inline packages and drop unused dependencies

Replace external golang-packages config file with an inline array,
remove 6 unused packages (actionlint, antidot, gopls, templ, html2md,
pup), and update documentation to match cargo script style.
This commit is contained in:
2026-02-04 02:59:26 +02:00
parent 9b7942a9fb
commit 9d7a1acd30
3 changed files with 23 additions and 57 deletions

View File

@@ -1,29 +0,0 @@
// These are golang packages I use,
// so they should be available with all versions
// Git Profile allows you to switch between user profiles in git repos
github.com/dotzero/git-profile@latest
// An extensible command line tool or library to format yaml files.
github.com/google/yamlfmt/cmd/yamlfmt@latest
// Parsing HTML at the command line
github.com/ericchiang/pup@latest
// HTML to Markdown converter
github.com/suntong/html2md@latest
// cheat allows you to create and view interactive cheatsheets on the cli.
github.com/cheat/cheat/cmd/cheat@latest
// Render markdown on the CLI, with pizzazz! 💅
github.com/charmbracelet/glow@latest
// Static checker for GitHub Actions workflow files
github.com/rhysd/actionlint/cmd/actionlint@latest
// Cleans up your $HOME from those pesky dotfiles
github.com/doron-cohen/antidot@latest
// FZF is a general-purpose command-line fuzzy finder.
github.com/junegunn/fzf@latest
// gopls, the Go language server
golang.org/x/tools/gopls@latest
// A language for writing HTML user interfaces in Go.
github.com/a-h/templ/cmd/templ@latest
// A tool for glamorous shell scripts 🎀
github.com/charmbracelet/gum@latest
// A terminal session manager
github.com/joshmedeski/sesh/v2@latest

View File

@@ -1,6 +1,6 @@
# install-go-packages
Installs Go binaries defined in `config/go/packages`.
Install Go packages defined in the script.
## Usage
@@ -8,5 +8,11 @@ Installs Go binaries defined in `config/go/packages`.
scripts/install-go-packages.sh
```
The script uses `go install` for each package path listed in the configuration
file.
## What it does
1. Checks that `go` is available.
2. Installs each package from the inline list using `go install`.
3. Runs post-install steps (e.g. generating shell completions).
4. Clears the Go module and build caches.
To add or remove packages, edit the `packages` array in `scripts/install-go-packages.sh`.

View File

@@ -11,31 +11,25 @@ msgr run "Installing go packages"
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0
[[ -z "$ASDF_GOLANG_DEFAULT_PACKAGES_FILE" ]] \
&& ASDF_GOLANG_DEFAULT_PACKAGES_FILE="$DOTFILES/config/asdf/golang-packages"
# Packages are defined in $DOTFILES/config/asdf/golang-packages, one per line
# Skip comments and empty lines
packages=()
if [[ -f "$ASDF_GOLANG_DEFAULT_PACKAGES_FILE" ]]; then
while IFS= read -r line; do
# Skip comments
if [[ ${line:0:1} == "#" ]]; then continue; fi
if [[ ${line:0:1} == "/" ]]; then continue; fi
# Skip empty lines
if [[ -z "$line" ]]; then continue; fi
packages+=("$line")
done < "$ASDF_GOLANG_DEFAULT_PACKAGES_FILE"
fi
# Go packages to install
packages=(
github.com/dotzero/git-profile@latest # Switch between git user profiles
github.com/google/yamlfmt/cmd/yamlfmt@latest # Format yaml files
github.com/cheat/cheat/cmd/cheat@latest # Interactive cheatsheets on the CLI
github.com/charmbracelet/glow@latest # Render markdown on the CLI
github.com/junegunn/fzf@latest # General-purpose fuzzy finder
github.com/charmbracelet/gum@latest # Glamorous shell scripts
github.com/joshmedeski/sesh/v2@latest # Terminal session manager
)
# Function to install go packages
install_packages()
{
for pkg in "${packages[@]}"; do
# Trim spaces
pkg=${pkg// /}
# Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
# Strip inline comments and trim whitespace
pkg="${pkg%%#*}"
pkg="${pkg// /}"
[[ -z "$pkg" ]] && continue
msgr nested "Installing go package: $pkg"
go install "$pkg"
@@ -52,11 +46,6 @@ post_install()
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
&& msgr run_done "Installed completions for git-profile"
fi
if command -v antidot &> /dev/null; then
antidot update \
&& msgr run_done "Updated antidot database"
fi
}
# Function to clear go cache