diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..00e0fd4f2f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,19 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/go/.devcontainer/base.Dockerfile + +# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster +ARG VARIANT="1.17-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} + +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] Uncomment this section to install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends podman buildah skopeo + +# [Optional] Uncomment the next line to use go get to install anything else you need +# RUN go get -x + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..c798c5176e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,47 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/go +{ + "name": "Go", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.17 + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local arm64/Apple Silicon. + "VARIANT": "1-bullseye", + // Options + "NODE_VERSION": "none" + } + }, + "runArgs": [ + "--init", + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + // Set *default* container specific settings.json values on container create. + "settings": { + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true, + "go.gopath": "/go", + "go.goroot": "/usr/local/go" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "golang.Go" + ], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "make setup", + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "docker-in-docker": "latest", + "kubectl-helm-minikube": "latest", + "git": "latest", + "git-lfs": "latest", + "github-cli": "latest", + "azure-cli": "latest" + } +} diff --git a/Makefile b/Makefile index 3e8bf9c0cf..6f6ef2df27 100644 --- a/Makefile +++ b/Makefile @@ -408,7 +408,7 @@ $(REPO_ROOT)/.git/hooks/pre-push: install-hooks: $(REPO_ROOT)/.git/hooks/pre-push ## installs git hooks -setup: install-hooks ## performs common required repo setup +setup: tools install-hooks ## performs common required repo setup version: ## prints the version @echo $(VERSION) @@ -438,7 +438,7 @@ gocov-xml: $(GOCOV_XML) ## Build gocov-xml $(GOFUMPT): $(TOOLS_DIR)/go.mod cd $(TOOLS_DIR); go mod download; go build -tags=tools -o bin/gofumpt mvdan.cc/gofumpt -gofmt gofumpt: $(GOFUMPT) ## Build gofumpt +gofumpt: $(GOFUMPT) ## Build gofumpt $(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod cd $(TOOLS_DIR); go mod download; go build -tags=tools -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint @@ -458,4 +458,4 @@ mockgen: $(MOCKGEN) ## Build mockgen clean-tools: rm -r build/tools/bin -tools: gocov gocov-xml go-junit-report golangci-lint gofmt ## Build bins for build tools +tools: gocov gocov-xml go-junit-report golangci-lint gofumpt ## Build bins for build tools