Skip to content

Commit 2ba13a8

Browse files
fix go install
1 parent 195c7ff commit 2ba13a8

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

opt/profiles/.goenv.sh

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,60 @@
1-
# export GOPATH=$HOME/GitHub/go
2-
# export PATH=$PATH:$GOPATH/bin
3-
# unset GOROOT
41
# https://golang.org/doc/gopath_code.html#GOPATH
5-
# export PATH=$PATH:$(go env GOPATH)/bin
62
if [[ -d $HOME/.goenv ]]; then
73
export PATH=$HOME/.goenv/bin:$PATH
84
fi
95

10-
# export GOENV_ROOT=$HOME/go
11-
export GOENV_ROOT="$HOME/.goenv"
6+
export GOENV_ROOT=$HOME/go
127
if [[ "$(uname -r | awk -F'-' '{print $3}')" = "Microsoft" ]] ; then
138
export GOENV_ROOT=/mnt/c/Program\ Files/Go
149
alias go='go.exe'
1510
fi
16-
export PATH="$GOENV_ROOT/bin:$PATH"
1711

1812
# requires brew install goenv
1913
goenv install latest --skip-existing
2014
eval "$(goenv init -)"
2115

16+
# set GOENV_VERSION
2217
goenv shell $(goenv versions --bare|tail -1)
18+
19+
# some debug output and default settings to put go in the path
20+
export GO_BINARY=$(goenv which go)
21+
export GO_BINPATH=$(dirname ${GO_BINARY})
22+
export PATH=${GO_BINPATH}:${PATH}
23+
echo "GOENV_VERSION => ${GOENV_VERSION}"
24+
echo "GO_BINARY => ${GO_BINARY}"
25+
echo "GO_BINPATH => ${GO_BINPATH}"
26+
27+
# install some go command line tools
28+
go install github.com/bazelbuild/buildtools/buildifier@latest
29+
go install golang.org/x/tools/gopls@latest
30+
go install github.com/go-delve/delve/cmd/dlv@latest
31+
32+
# verify we have the tools
33+
# Check if tools are installed and working
34+
if command -v buildifier >/dev/null 2>&1; then
35+
echo "✓ buildifier $(buildifier --version) is installed"
36+
else
37+
echo "✗ buildifier is not installed properly"
38+
fi
39+
40+
if command -v gopls >/dev/null 2>&1; then
41+
echo "✓ gopls $(gopls version) is installed"
42+
else
43+
echo "✗ gopls is not installed properly"
44+
fi
45+
46+
if command -v dlv >/dev/null 2>&1; then
47+
echo "✓ delve $(dlv version) is installed"
48+
else
49+
echo "✗ delve debugger is not installed properly"
50+
fi
51+
52+
if command -v go >/dev/null 2>&1; then
53+
echo "$(go version) is installed"
54+
else
55+
echo "✗ go is not installed properly"
56+
fi
57+
2358
go version
2459
which go
2560

opt/profiles/.profile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,3 @@ export GPG_TTY=$(tty)
122122

123123
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
124124
alias bazel='bazelisk'
125-
export PATH="$HOME/.goenv/bin:$PATH"
126-
eval "$(goenv init -)"

0 commit comments

Comments
 (0)