Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 4a370f7

Browse files
authored
Handle go 1.15
1 parent 6b58ff7 commit 4a370f7

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

containers/codespaces-linux/.devcontainer/library-scripts/go-debian.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,21 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
167167
export GOPATH=/tmp/gotools
168168
export GOCACHE=/tmp/gotools/cache
169169

170-
(echo "${GO_TOOLS}" | xargs -n 1 go install -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
170+
# Use go get for versions of go under 1.16
171+
go_install_command=install
172+
if [[ "1.16" > "$(go version | grep -oP 'go\K[0-9]+\.[0-9]+\.[0-9]+')" ]]; then
173+
export GO111MODULE=on
174+
go_install_command=get
175+
echo "Go version < 1.16, using go get."
176+
fi
177+
178+
(echo "${GO_TOOLS}" | xargs -n 1 go ${go_install_command} -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
171179

172180
# Move Go tools into path and clean up
173181
mv /tmp/gotools/bin/* ${TARGET_GOPATH}/bin/
174182

175183
# install dlv-dap (dlv@master)
176-
go install -v github.com/go-delve/delve/cmd/dlv@master 2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
184+
go ${go_install_command} -v github.com/go-delve/delve/cmd/dlv@master 2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
177185
mv /tmp/gotools/bin/dlv ${TARGET_GOPATH}/bin/dlv-dap
178186

179187
rm -rf /tmp/gotools

containers/go/.devcontainer/library-scripts/go-debian.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,21 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
167167
export GOPATH=/tmp/gotools
168168
export GOCACHE=/tmp/gotools/cache
169169

170-
(echo "${GO_TOOLS}" | xargs -n 1 go install -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
170+
# Use go get for versions of go under 1.16
171+
go_install_command=install
172+
if [[ "1.16" > "$(go version | grep -oP 'go\K[0-9]+\.[0-9]+\.[0-9]+')" ]]; then
173+
export GO111MODULE=on
174+
go_install_command=get
175+
echo "Go version < 1.16, using go get."
176+
fi
177+
178+
(echo "${GO_TOOLS}" | xargs -n 1 go ${go_install_command} -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
171179

172180
# Move Go tools into path and clean up
173181
mv /tmp/gotools/bin/* ${TARGET_GOPATH}/bin/
174182

175183
# install dlv-dap (dlv@master)
176-
go install -v github.com/go-delve/delve/cmd/dlv@master 2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
184+
go ${go_install_command} -v github.com/go-delve/delve/cmd/dlv@master 2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
177185
mv /tmp/gotools/bin/dlv ${TARGET_GOPATH}/bin/dlv-dap
178186

179187
rm -rf /tmp/gotools

script-library/go-debian.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,21 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
167167
export GOPATH=/tmp/gotools
168168
export GOCACHE=/tmp/gotools/cache
169169

170-
(echo "${GO_TOOLS}" | xargs -n 1 go install -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
170+
# Use go get for versions of go under 1.16
171+
go_install_command=install
172+
if [[ "1.16" > "$(go version | grep -oP 'go\K[0-9]+\.[0-9]+\.[0-9]+')" ]]; then
173+
export GO111MODULE=on
174+
go_install_command=get
175+
echo "Go version < 1.16, using go get."
176+
fi
177+
178+
(echo "${GO_TOOLS}" | xargs -n 1 go ${go_install_command} -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
171179

172180
# Move Go tools into path and clean up
173181
mv /tmp/gotools/bin/* ${TARGET_GOPATH}/bin/
174182

175183
# install dlv-dap (dlv@master)
176-
go install -v github.com/go-delve/delve/cmd/dlv@master 2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
184+
go ${go_install_command} -v github.com/go-delve/delve/cmd/dlv@master 2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
177185
mv /tmp/gotools/bin/dlv ${TARGET_GOPATH}/bin/dlv-dap
178186

179187
rm -rf /tmp/gotools

0 commit comments

Comments
 (0)