This repository was archived by the owner on Nov 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed
codespaces-linux/.devcontainer/library-scripts
go/.devcontainer/library-scripts Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -167,13 +167,21 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
167
167
export GOPATH=/tmp/gotools
168
168
export GOCACHE=/tmp/gotools/cache
169
169
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
171
179
172
180
# Move Go tools into path and clean up
173
181
mv /tmp/gotools/bin/* ${TARGET_GOPATH} /bin/
174
182
175
183
# 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
177
185
mv /tmp/gotools/bin/dlv ${TARGET_GOPATH} /bin/dlv-dap
178
186
179
187
rm -rf /tmp/gotools
Original file line number Diff line number Diff line change @@ -167,13 +167,21 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
167
167
export GOPATH=/tmp/gotools
168
168
export GOCACHE=/tmp/gotools/cache
169
169
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
171
179
172
180
# Move Go tools into path and clean up
173
181
mv /tmp/gotools/bin/* ${TARGET_GOPATH} /bin/
174
182
175
183
# 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
177
185
mv /tmp/gotools/bin/dlv ${TARGET_GOPATH} /bin/dlv-dap
178
186
179
187
rm -rf /tmp/gotools
Original file line number Diff line number Diff line change @@ -167,13 +167,21 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
167
167
export GOPATH=/tmp/gotools
168
168
export GOCACHE=/tmp/gotools/cache
169
169
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
171
179
172
180
# Move Go tools into path and clean up
173
181
mv /tmp/gotools/bin/* ${TARGET_GOPATH} /bin/
174
182
175
183
# 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
177
185
mv /tmp/gotools/bin/dlv ${TARGET_GOPATH} /bin/dlv-dap
178
186
179
187
rm -rf /tmp/gotools
You can’t perform that action at this time.
0 commit comments