mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-08-23 22:16:48 +00:00
feat: add go-essentials
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: go-essentials
|
||||
homepage: https://webinstall.dev/go-essentials
|
||||
tagline: |
|
||||
meta package for go and the de facto standard go tools packages
|
||||
---
|
||||
|
||||
To update (replacing the current version) run `webi go-essentials`.
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> A collection of extremely useful official and de facto standard go tooling.
|
||||
|
||||
This meta package will install [Go](https://golang.org/) at the specified
|
||||
version as well as the full set of tooling used by most IDEs and editor plugins,
|
||||
including:
|
||||
|
||||
- [godoc](https://pkg.go.dev/golang.org/x/tools/cmd/godoc)
|
||||
- [gopls](https://pkg.go.dev/golang.org/x/tools/gopls)
|
||||
- [guru](https://pkg.go.dev/golang.org/x/tools/cmd/guru)
|
||||
- [golint](https://pkg.go.dev/golang.org/x/lint/golint)
|
||||
- [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports)
|
||||
- [gomvpkg](https://pkg.go.dev/golang.org/x/tools/cmd/gomvpkg)
|
||||
- [gorename](https://pkg.go.dev/golang.org/x/tools/cmd/gorename)
|
||||
- [gotype](https://pkg.go.dev/golang.org/x/tools/cmd/gotype)
|
||||
- [stringer](https://pkg.go.dev/golang.org/x/tools/cmd/stringer)
|
||||
|
||||
It **DOES NOT** include these, which you may also want:
|
||||
|
||||
- Vim Utilities
|
||||
- [vim-essentials](/vim-essentials) (de facto standard plugins and one-liners
|
||||
for vim)
|
||||
- [vim-go](/vim-go) (golang support for vim, and VSCode)
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/pwsh
|
||||
|
||||
echo "'go@$Env:WEBI_TAG' is an alias for 'golang@$Env:WEBI_VERSION'"
|
||||
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
|
||||
curl.exe -fsSL "$Env:WEBI_HOST/golang@$Env:WEBI_VERSION" | powershell
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
|
||||
__run_go_essentials() {
|
||||
WEBI__GO_ESSENTIALS='true'
|
||||
export WEBI__GO_ESSENTIALS
|
||||
if [ -z "${WEBI__GO_INSTALL:-}" ]; then
|
||||
webi "golang@${WEBI_TAG}"
|
||||
fi
|
||||
|
||||
export PATH="$HOME/.local/opt/go/bin:$PATH"
|
||||
|
||||
my_install="install"
|
||||
# go1.16 is the min version for proper 'go install'
|
||||
my_version="$(
|
||||
go version | cut -d' ' -f3
|
||||
)"
|
||||
my_major="$(
|
||||
echo "${my_version}" | cut -d'.' -f1 || echo '0'
|
||||
)"
|
||||
my_minor="$(
|
||||
echo "${my_version}" | cut -d'.' -f2 || echo '0'
|
||||
)"
|
||||
|
||||
my_install="get"
|
||||
if [ "${my_major}" = "go1" ]; then
|
||||
if [ "${my_minor}" -ge 16 ]; then
|
||||
my_install="install"
|
||||
fi
|
||||
elif [ "${my_major}" = "go2" ]; then
|
||||
my_install="install"
|
||||
fi
|
||||
|
||||
# Install x go
|
||||
echo "Building go language tools..."
|
||||
export GO111MODULE=on
|
||||
|
||||
# See https://pkg.go.dev/mod/golang.org/x/tools?tab=packages
|
||||
|
||||
echo ""
|
||||
echo godoc
|
||||
go "${my_install}" golang.org/x/tools/cmd/godoc@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo gopls
|
||||
go "${my_install}" golang.org/x/tools/gopls@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo guru
|
||||
go "${my_install}" golang.org/x/tools/cmd/guru@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo golint
|
||||
go "${my_install}" golang.org/x/lint/golint@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo goimports
|
||||
go "${my_install}" golang.org/x/tools/cmd/goimports@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo gomvpkg
|
||||
go "${my_install}" golang.org/x/tools/cmd/gomvpkg@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo gorename
|
||||
go "${my_install}" golang.org/x/tools/cmd/gorename@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo gotype
|
||||
go "${my_install}" golang.org/x/tools/cmd/gotype@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo stringer
|
||||
go "${my_install}" golang.org/x/tools/cmd/stringer@latest > /dev/null #2>/dev/null
|
||||
|
||||
echo ""
|
||||
|
||||
printf '\n'
|
||||
printf 'Suggestion: Also check out these great productivity multipliers:\n'
|
||||
printf '\n'
|
||||
printf ' - vim-essentials (sensible defaults for vim)\n'
|
||||
printf ' - vim-go (golang linting, etc)\n'
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
__run_go_essentials
|
||||
Reference in New Issue
Block a user