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

Commit 6735f08

Browse files
authored
update go container build script and devcontainer.json (#744)
* update go container build script and devcontainer.json Reduce the number of pre-installed go tools - gopls is the default language feature provider for golang.go since its v0.22.0, so preinstall only the required tools with the default settings. For additional tools, the extension will prompt users to install when necessary. Also, clean up devcontainer's go extension settings. Some gopls settings are outdated. Some [go] settings are unnecessary because the extension sets them up by default, and the gopls update setting is now obsolete. * go-debian.sh: remove gocode-gomod and redundant golangci-lint
1 parent bbd3a29 commit 6735f08

File tree

5 files changed

+10
-42
lines changed

5 files changed

+10
-42
lines changed

containers/codespaces-linux-stretch/.devcontainer/devcontainer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
},
66
"settings": {
77
"terminal.integrated.shell.linux": "/bin/bash",
8-
"go.useGoProxyToCheckForToolUpdates": false,
8+
"go.toolsManagement.checkForUpdates": "off",
99
"go.useLanguageServer": true,
1010
"go.gopath": "/go",
1111
"go.goroot": "/usr/local/go",
12-
"go.toolsGopath": "/go/bin",
1312
"python.pythonPath": "/opt/python/latest/bin/python",
1413
"python.linting.enabled": true,
1514
"python.linting.pylintEnabled": true,

containers/codespaces-linux/.devcontainer/devcontainer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
},
66
"settings": {
77
"terminal.integrated.shell.linux": "/bin/bash",
8-
"go.useGoProxyToCheckForToolUpdates": false,
8+
"go.toolsManagement.checkForUpdates": "off",
99
"go.useLanguageServer": true,
1010
"go.gopath": "/go",
1111
"go.goroot": "/usr/local/go",
12-
"go.toolsGopath": "/go/bin",
1312
"python.pythonPath": "/opt/python/latest/bin/python",
1413
"python.linting.enabled": true,
1514
"python.linting.pylintEnabled": true,

containers/go/.devcontainer/devcontainer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
// Set *default* container specific settings.json values on container create.
1616
"settings": {
1717
"terminal.integrated.shell.linux": "/bin/bash",
18-
"go.useGoProxyToCheckForToolUpdates": false,
18+
"go.toolsManagement.checkForUpdates": "off",
1919
"go.useLanguageServer": true,
2020
"go.gopath": "/go",
2121
"go.goroot": "/usr/local/go",
22-
"go.toolsGopath": "/go/bin"
2322
},
2423

2524
// Add the IDs of extensions you want installed when the container is created.

repository-containers/github.com/terraform-providers/terraform-provider-azurerm/.devcontainer/devcontainer.json

+1-12
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,8 @@
2121
"apiVersion": 2,
2222
"showGlobalVariables": true
2323
},
24-
"[go]": {
25-
"editor.snippetSuggestions": "none",
26-
"editor.formatOnSave": true,
27-
"editor.codeActionsOnSave": {
28-
"source.organizeImports": true,
29-
}
30-
},
3124
"gopls": {
32-
"usePlaceholders": true, // add parameter placeholders when completing a function
33-
// Experimental settings
34-
"completeUnimported": true, // autocomplete unimported packages
35-
"watchFileChanges": true, // watch file changes outside of the editor
36-
"deepCompletion": true, // enable deep completion
25+
"ui.usePlaceholders": true, // add parameter placeholders when completing a function
3726
},
3827
"files.eol": "\n", // formatting only supports LF line endings
3928
},

script-library/go-debian.sh

+6-24
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,16 @@ else
8484
echo "Go already installed. Skipping."
8585
fi
8686

87-
# Install Go tools
88-
GO_TOOLS_WITH_MODULES="\
87+
# Install Go tools that are isImportant && !replacedByGopls based on
88+
# https://github.com/golang/vscode-go/blob/0c6dce4a96978f61b022892c1376fe3a00c27677/src/goTools.ts#L188
89+
# exception: golangci-lint is installed using their install script below.
90+
GO_TOOLS="\
8991
golang.org/x/tools/gopls \
9092
honnef.co/go/tools/... \
91-
golang.org/x/tools/cmd/gorename \
92-
golang.org/x/tools/cmd/goimports \
93-
golang.org/x/tools/cmd/guru \
9493
golang.org/x/lint/golint \
95-
github.com/mdempsky/gocode \
96-
github.com/cweill/gotests/... \
97-
github.com/haya14busa/goplay/cmd/goplay \
98-
github.com/sqs/goreturns \
99-
github.com/josharian/impl \
100-
github.com/davidrjenni/reftools/cmd/fillstruct \
94+
github.com/mgechev/revive \
10195
github.com/uudashr/gopkgs/v2/cmd/gopkgs \
10296
github.com/ramya-rao-a/go-outline \
103-
github.com/acroca/go-symbols \
104-
github.com/godoctor/godoctor \
105-
github.com/rogpeppe/godef \
106-
github.com/zmb3/gogetdoc \
107-
github.com/fatih/gomodifytags \
108-
github.com/mgechev/revive \
10997
github.com/go-delve/delve/cmd/dlv"
11098
if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
11199
echo "Installing common Go tools..."
@@ -117,19 +105,13 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
117105

118106
# Go tools w/module support
119107
export GO111MODULE=on
120-
(echo "${GO_TOOLS_WITH_MODULES}" | xargs -n 1 go get -v )2>&1
121-
122-
# gocode-gomod
123-
export GO111MODULE=auto
124-
go get -v -d github.com/stamblerre/gocode 2>&1
125-
go build -o gocode-gomod github.com/stamblerre/gocode
108+
(echo "${GO_TOOLS}" | xargs -n 1 go get -v )2>&1
126109

127110
# golangci-lint
128111
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${TARGET_GOPATH}/bin 2>&1
129112

130113
# Move Go tools into path and clean up
131114
mv /tmp/gotools/bin/* ${TARGET_GOPATH}/bin/
132-
mv gocode-gomod ${TARGET_GOPATH}/bin/
133115
rm -rf /tmp/gotools
134116
chown -R ${USERNAME} "${TARGET_GOPATH}"
135117
fi

0 commit comments

Comments
 (0)