diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..43cc4a46 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +ARG GO_VERSION=1.19 +ARG ALPINE_VERSION=3.16 + +FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} + +# CA certificates +RUN apk add -q --update --progress --no-cache ca-certificates make curl gpg dirmngr bash sudo bat file tzdata git mandoc git-doc openssh-client zsh zsh-vcs vim libstdc++ github-cli + +ENV EDITOR=vim +ENV LANG=en_US.UTF-8 +ENV TERM=xterm +ENV GO111MODULE=on + +# install golang tools +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0 +RUN go install github.com/cweill/gotests/... && \ + go install github.com/swaggo/swag/cmd/swag@latest && \ + go install github.com/go-delve/delve/cmd/dlv@latest && \ + go install github.com/fatih/gomodifytags@latest && \ + go install github.com/vektra/mockery/v2@latest && \ + go install github.com/golang/mock/mockgen@v1.6.0 && \ + go install golang.org/x/tools/gopls@latest && \ + go install github.com/josharian/impl@latest && \ + go install github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..0bda61cc --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,83 @@ +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.137.0/containers/go +{ + "name": "Go", + "build": { + "dockerfile": "Dockerfile" + }, + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + // Set *default* container specific settings.json values on container create. + "settings": { + "go.toolsManagement.autoUpdate": false, + "go.toolsManagement.checkForUpdates": "off", + "go.gopath": "/go", + "go.lintOnSave": "package", + "go.vetOnSave": "package", + "go.formatTool": "goimports", + "go.useLanguageServer": true, + "go.autocompleteUnimportedPackages": true, + "go.gotoSymbol.includeImports": true, + "go.gotoSymbol.includeGoroot": true, + "go.editorContextMenuCommands": { + "toggleTestFile": true, + "addTags": true, + "removeTags": false, + "fillStruct": true, + "testAtCursor": true, + "testFile": false, + "testPackage": false, + "generateTestForFunction": true, + "generateTestForFile": false, + "generateTestForPackage": false, + "addImport": true, + "testCoverage": true, + "playground": true, + "debugTestAtCursor": true, + "benchmarkAtCursor": false + }, + "go.enableCodeLens": { + "references": true, + "runtest": true + }, + "codeQL.telemetry.enableTelemetry": false, + "codeQL.runningQueries.memory": 2048, + "codeQL.runningQueries.debug": true, + "git.autofetch": true, + "editor.experimental.stickyScroll.enabled": true, + "editor.guides.bracketPairs": true, + "editor.renderFinalNewline": true, + "editor.codeLens": true, + "editor.insertSpaces": true, + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "editor.snippetSuggestions": "none", + "editor.codeActionsOnSave": { + "source.organizeImports": true, + "source.fixAll": true + }, + "workbench.iconTheme": "vscode-icons", + "files.trimTrailingWhitespace": true + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "golang.Go", + "ms-azuretools.vscode-docker", + "github.vscode-codeql", + "davidanson.vscode-markdownlint", + "shardulm94.trailing-spaces", + "github.vscode-pull-request-github", + "eamodio.gitlens", + "IBM.output-colorizer", + "bungcip.better-toml" + ], + // 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": "", + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + //"remoteUser": "vscode" +} \ No newline at end of file