restore 216335b
				
					
				
			This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
# Update the VARIANT arg in devcontainer.json to pick an Go version
 | 
			
		||||
ARG VARIANT=1.14
 | 
			
		||||
ARG VARIANT=1
 | 
			
		||||
FROM golang:${VARIANT}
 | 
			
		||||
 | 
			
		||||
# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in
 | 
			
		||||
@@ -27,17 +27,17 @@ RUN apt-get update \
 | 
			
		||||
    && rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
# Install Go tools
 | 
			
		||||
 | 
			
		||||
ENV GO111MODULE=on
 | 
			
		||||
 | 
			
		||||
ARG GO_TOOLS_WITH_MODULES="\
 | 
			
		||||
    golang.org/x/tools/gopls \
 | 
			
		||||
    honnef.co/go/tools/... \
 | 
			
		||||
    golang.org/x/tools/cmd/gorename \
 | 
			
		||||
    golang.org/x/tools/cmd/goimports \
 | 
			
		||||
    golang.org/x/tools/cmd/guru \
 | 
			
		||||
    golang.org/x/lint/golint \
 | 
			
		||||
    github.com/mdempsky/gocode \
 | 
			
		||||
    github.com/cweill/gotests/... \
 | 
			
		||||
    github.com/haya14busa/goplay/cmd/goplay \
 | 
			
		||||
    github.com/sqs/goreturns \
 | 
			
		||||
    github.com/josharian/impl \
 | 
			
		||||
    github.com/davidrjenni/reftools/cmd/fillstruct \
 | 
			
		||||
    github.com/uudashr/gopkgs/v2/cmd/gopkgs \
 | 
			
		||||
@@ -49,13 +49,29 @@ ARG GO_TOOLS_WITH_MODULES="\
 | 
			
		||||
    github.com/fatih/gomodifytags \
 | 
			
		||||
    github.com/mgechev/revive \
 | 
			
		||||
    github.com/go-delve/delve/cmd/dlv"
 | 
			
		||||
 | 
			
		||||
RUN (echo "${GO_TOOLS_WITH_MODULES}" | xargs -n 1 go get )2>&1 \
 | 
			
		||||
RUN mkdir -p /tmp/gotools \
 | 
			
		||||
    && cd /tmp/gotools \
 | 
			
		||||
    && export GOPATH=/tmp/gotools \
 | 
			
		||||
    # Go tools w/module support
 | 
			
		||||
    && export GO111MODULE=on \
 | 
			
		||||
    && (echo "${GO_TOOLS_WITH_MODULES}" | xargs -n 1 go get -x )2>&1 \
 | 
			
		||||
    # gocode-gomod
 | 
			
		||||
    && export GO111MODULE=auto \
 | 
			
		||||
    && go get -x -d github.com/stamblerre/gocode 2>&1 \
 | 
			
		||||
    && go build -o gocode-gomod github.com/stamblerre/gocode \
 | 
			
		||||
    # golangci-lint
 | 
			
		||||
    && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin 2>&1
 | 
			
		||||
    && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin 2>&1 \
 | 
			
		||||
    # Move Go tools into path and clean up
 | 
			
		||||
    && mv /tmp/gotools/bin/* /usr/local/bin/ \
 | 
			
		||||
    && mv gocode-gomod /usr/local/bin/ \
 | 
			
		||||
    && rm -rf /tmp/gotools
 | 
			
		||||
 | 
			
		||||
ENV GO111MODULE=auto
 | 
			
		||||
 | 
			
		||||
# [Optional] Uncomment the next line to use go get to install anything else you need
 | 
			
		||||
# RUN go get -x <your-dependency-or-tool>
 | 
			
		||||
 | 
			
		||||
# [Optional] Uncomment this section to install additional OS packages.
 | 
			
		||||
# RUN apt-get update \
 | 
			
		||||
#     && export DEBIAN_FRONTEND=noninteractive \
 | 
			
		||||
#     && apt-get -y install --no-install-recommends <your-package-list-here>
 | 
			
		||||
#     && apt-get -y install --no-install-recommends <your-package-list-here>
 | 
			
		||||
@@ -1,52 +1,31 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "Go",
 | 
			
		||||
  "build": {
 | 
			
		||||
    "dockerfile": "Dockerfile",
 | 
			
		||||
    // Update the VARIANT arg to pick a version of Go
 | 
			
		||||
    "args": { "VARIANT": "1.14" }
 | 
			
		||||
  },
 | 
			
		||||
  "runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
 | 
			
		||||
	"name": "Go",
 | 
			
		||||
	"build": {
 | 
			
		||||
		"dockerfile": "Dockerfile",
 | 
			
		||||
		// Update the VARIANT arg to pick a version of Go
 | 
			
		||||
		"args": { "VARIANT": "1" }
 | 
			
		||||
	},
 | 
			
		||||
	"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
 | 
			
		||||
 | 
			
		||||
  // Set *default* container specific settings.json values on container create.
 | 
			
		||||
  "settings": {
 | 
			
		||||
    "terminal.integrated.shell.linux": "/bin/bash",
 | 
			
		||||
    "go.useLanguageServer": true,
 | 
			
		||||
    "[go]": {
 | 
			
		||||
      "editor.formatOnSave": true,
 | 
			
		||||
      "editor.codeActionsOnSave": {
 | 
			
		||||
        "source.organizeImports": true
 | 
			
		||||
      },
 | 
			
		||||
      // Optional: Disable snippets, as they conflict with completion ranking.
 | 
			
		||||
      "editor.snippetSuggestions": "none"
 | 
			
		||||
    },
 | 
			
		||||
    "[go.mod]": {
 | 
			
		||||
      "editor.formatOnSave": true,
 | 
			
		||||
      "editor.codeActionsOnSave": {
 | 
			
		||||
        "source.organizeImports": true
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "gopls": {
 | 
			
		||||
      // Add parameter placeholders when completing a function.
 | 
			
		||||
			"usePlaceholders": true,
 | 
			
		||||
			// the completion engine is allowed to make suggestions for packages that you do not currently import.
 | 
			
		||||
			"completeUnimported": true,
 | 
			
		||||
	// Set *default* container specific settings.json values on container create.
 | 
			
		||||
	"settings": { 
 | 
			
		||||
		"terminal.integrated.shell.linux": "/bin/bash",
 | 
			
		||||
		"go.gopath": "/go",
 | 
			
		||||
		"go.inferGopath": true,
 | 
			
		||||
		"go.useLanguageServer": true
 | 
			
		||||
	},
 | 
			
		||||
	
 | 
			
		||||
	// Add the IDs of extensions you want installed when the container is created.
 | 
			
		||||
	"extensions": [
 | 
			
		||||
		"golang.Go"
 | 
			
		||||
	],
 | 
			
		||||
 | 
			
		||||
      // If true, enable additional analyses with staticcheck.
 | 
			
		||||
      // Warning: This will significantly increase memory usage.
 | 
			
		||||
      "staticcheck": true
 | 
			
		||||
    },
 | 
			
		||||
    "go.lintTool": "golangci-lint"
 | 
			
		||||
  },
 | 
			
		||||
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
			
		||||
	"forwardPorts": [9000],
 | 
			
		||||
 | 
			
		||||
  // Add the IDs of extensions you want installed when the container is created.
 | 
			
		||||
  "extensions": ["golang.Go"],
 | 
			
		||||
	// Use 'postCreateCommand' to run commands after the container is created.
 | 
			
		||||
	// "postCreateCommand": "go version",
 | 
			
		||||
 | 
			
		||||
  // Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
			
		||||
  "forwardPorts": [9000],
 | 
			
		||||
 | 
			
		||||
  // Use 'postCreateCommand' to run commands after the container is created.
 | 
			
		||||
  // "postCreateCommand": "go version",
 | 
			
		||||
 | 
			
		||||
  // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
 | 
			
		||||
  "remoteUser": "vscode"
 | 
			
		||||
}
 | 
			
		||||
	// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
 | 
			
		||||
	"remoteUser": "vscode"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user