mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-14 22:53:21 +00:00
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:
@@ -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
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# install-go-packages
|
# install-go-packages
|
||||||
|
|
||||||
Installs Go binaries defined in `config/go/packages`.
|
Install Go packages defined in the script.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -8,5 +8,11 @@ Installs Go binaries defined in `config/go/packages`.
|
|||||||
scripts/install-go-packages.sh
|
scripts/install-go-packages.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
The script uses `go install` for each package path listed in the configuration
|
## What it does
|
||||||
file.
|
|
||||||
|
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`.
|
||||||
|
|||||||
@@ -11,31 +11,25 @@ msgr run "Installing go packages"
|
|||||||
|
|
||||||
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0
|
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0
|
||||||
|
|
||||||
[[ -z "$ASDF_GOLANG_DEFAULT_PACKAGES_FILE" ]] \
|
# Go packages to install
|
||||||
&& ASDF_GOLANG_DEFAULT_PACKAGES_FILE="$DOTFILES/config/asdf/golang-packages"
|
packages=(
|
||||||
|
github.com/dotzero/git-profile@latest # Switch between git user profiles
|
||||||
# Packages are defined in $DOTFILES/config/asdf/golang-packages, one per line
|
github.com/google/yamlfmt/cmd/yamlfmt@latest # Format yaml files
|
||||||
# Skip comments and empty lines
|
github.com/cheat/cheat/cmd/cheat@latest # Interactive cheatsheets on the CLI
|
||||||
packages=()
|
github.com/charmbracelet/glow@latest # Render markdown on the CLI
|
||||||
if [[ -f "$ASDF_GOLANG_DEFAULT_PACKAGES_FILE" ]]; then
|
github.com/junegunn/fzf@latest # General-purpose fuzzy finder
|
||||||
while IFS= read -r line; do
|
github.com/charmbracelet/gum@latest # Glamorous shell scripts
|
||||||
# Skip comments
|
github.com/joshmedeski/sesh/v2@latest # Terminal session manager
|
||||||
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
|
|
||||||
|
|
||||||
# Function to install go packages
|
# Function to install go packages
|
||||||
install_packages()
|
install_packages()
|
||||||
{
|
{
|
||||||
for pkg in "${packages[@]}"; do
|
for pkg in "${packages[@]}"; do
|
||||||
# Trim spaces
|
# Strip inline comments and trim whitespace
|
||||||
pkg=${pkg// /}
|
pkg="${pkg%%#*}"
|
||||||
# Skip comments
|
pkg="${pkg// /}"
|
||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
[[ -z "$pkg" ]] && continue
|
||||||
|
|
||||||
msgr nested "Installing go package: $pkg"
|
msgr nested "Installing go package: $pkg"
|
||||||
go install "$pkg"
|
go install "$pkg"
|
||||||
@@ -52,11 +46,6 @@ post_install()
|
|||||||
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
||||||
&& msgr run_done "Installed completions for git-profile"
|
&& msgr run_done "Installed completions for git-profile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v antidot &> /dev/null; then
|
|
||||||
antidot update \
|
|
||||||
&& msgr run_done "Updated antidot database"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to clear go cache
|
# Function to clear go cache
|
||||||
|
|||||||
Reference in New Issue
Block a user