Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add .vscode and .devcontainer #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .devcontainer/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dockerignore
devcontainer.json
docker-compose.yml
Dockerfile
README.md
1 change: 1 addition & 0 deletions .devcontainer/Dockefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM qmcgaw/godevcontainer
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM qmcgaw/godevcontainer
RUN cat >>~/.zshrc<<EOF
alias kx='kubectx'
alias kn='kubens'
alias kc='kubectl'
alias histgrep='history|grep'
EOF
110 changes: 110 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"name": "zipper",
"service": "vscode",
"dockerComposeFile": [
"docker-compose.yml"
],
"runServices": [
"vscode"
],
"shutdownAction": "stopCompose",
"postCreateCommand": "~/.windows.sh && go mod download && go mod tidy",
"workspaceFolder": "/workspace",
"extensions": [
"golang.go",
"eamodio.gitlens",
"davidanson.vscode-markdownlint",
"ms-azuretools.vscode-docker",
"shardulm94.trailing-spaces",
"bierner.emojisense",
"stkb.rewrap",
"vscode-icons-team.vscode-icons",
"github.vscode-pull-request-github",
"redhat.vscode-yaml",
"IBM.output-colorizer",
"hashicorp.terraform",
"mohsen1.prettify-json", // Prettify JSON data
],
"settings": {
"files.eol": "\n",
"files.autoSaveDelay": 5000,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"remote.extensionKind": {
"ms-azuretools.vscode-docker": "workspace"
},
"files.associations": {
"*.hcl": "terraform",
"*.yml": "yaml",
"*.yaml": "yaml",
"*.yml.j2": "yaml",
"*.yaml.j2": "yaml",
"*.json.j2": "json",
},
"editor.codeActionsOnSaveTimeout": 3000,
"editor.wordWrapColumn": 80,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.smoothScrolling": true,
"editor.cursorBlinking": "smooth",
"editor.cursorSmoothCaretAnimation": true,
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
},
"editor.rulers": [
80, // <- a ruler in the default color or as customized (with "editorRuler.foreground") at column 100
{
"column": 100,
"color": "#ff0000"
},
],
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "golang.go",
"editor.insertSpaces": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
"editor.snippetSuggestions": "none"
},
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
},
"gopls": {
"usePlaceholders": false,
"staticcheck": true
},
"go.autocompleteUnimportedPackages": true,
"go.gotoSymbol.includeImports": true,
"go.gotoSymbol.includeGoroot": true,
"go.lintTool": "golangci-lint",
"go.buildOnSave": "workspace",
"go.lintOnSave": "workspace",
"go.vetOnSave": "workspace",
"editor.formatOnSave": true,
"go.toolsEnvVars": {
"GOFLAGS": "-tags=",
"CGO_ENABLED": 0
},
"gopls.env": {
"GOFLAGS": "-tags="
},
"go.testEnvVars": {
"": "",
},
"go.testFlags": [
"-v",
"-race"
],
"go.coverOnSingleTest": true,
"go.coverOnSingleTestFile": true,
"go.coverOnTestPackage": true
}
}
33 changes: 33 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.7"

services:
vscode:
build: .
image: zipper
devices:
- /dev/net/tun:/dev/net/tun
volumes:
- ../:/workspace
# Docker socket to access Docker server
- /var/run/docker.sock:/var/run/docker.sock
# Docker configuration
- ~/.docker:/root/.docker:z
# SSH directory for Linux, OSX and WSL
- ~/.ssh:/root/.ssh:z
# For Windows without WSL, a copy will be made
# from /tmp/.ssh to ~/.ssh to fix permissions
#- ~/.ssh:/tmp/.ssh:ro
# Shell history persistence
- ~/.zsh_history:/root/.zsh_history:z
# Git config
- ~/.gitconfig:/root/.gitconfig:z
environment:
- TZ=
cap_add:
# For debugging with dlv
# - SYS_PTRACE
- NET_ADMIN
security_opt:
# For debugging with dlv
- seccomp:unconfined
entrypoint: zsh -c "tail -f /dev/null"
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"golang.go",
"dbaeumer.vscode-eslint"
]
}
30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Code",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"program": "${workspaceRoot}",
"env": {},
"args": [
"3000",
"./test/"
],
"showLog": true
},
{
"name": "Test Current File",
"type": "go",
"request": "launch",
"mode": "test",
"remotePath": "",
"program": "${file}",
"env": {},
"args": [],
"showLog": true
}
]
}
105 changes: 105 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"files.watcherExclude": {
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true,
"**/.svn": true,
"**/.git": true,
"**/__pycache__": true,
"**/node_modules": true,
"**/.min.js": true,
"**/.map": true,
"**/.pyc": true,
"**/.pyo": true,
"**/.exe": true,
"**/.dll": true,
"**/.obj": true,
"**/.o": true,
"**/.a": true,
"**/.lib": true,
"**/.so": true,
"**/.dylib": true,
"**/.ncb": true,
"**/.sdf": true,
"**/.suo": true,
"**/.pdb": true,
"**/.idb": true,
"**/.DS_Store": true,
"**/.psd": true,
"**/.svn/**": true
},
},
"files.associations": {
"*.nomad": "terraform",
"*.job": "terraform",
"*.hcl": "terraform",
"*.lib": "ytt",
"*.star": "starlark",
"*playbook.(yaml|yml)": "ansible",
"*.(yaml|yml)": "yaml",
},
//Editor
"editor.wordWrapColumn": 80,
"editor.wordWrap": "wordWrapColumn",
"editor.links": false,
"editor.minimap.maxColumn": 80,
"editor.minimap.renderCharacters": false,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.detectIndentation": true,
"editor.wordSeparators": "./\\\\()\\\"'-:$,.;<>~!@#%^&*|+=[]{}`~?",
"editor.glyphMargin": false,
"editor.suggestSelection": "first",
"editor.fontLigatures": true,
"editor.fontWeight": 400,
"editor.fontSize": 14,
"editor.rulers": [
80, // <- a ruler in the default color or as customized (with "editorRuler.foreground") at column 100
{
"column": 100,
"color": "#ff0000"
},
],
"git.confirmSync": false,
"git.autofetch": true,
"git.pullTags": false,
"git.autofetchPeriod": 60,
"git.enableSmartCommit": true,
// Go
"[go]": {
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.defaultFormatter": "golang.go",
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"files.eol": "\n", // formatting only supports LF line ending
},
"go.useLanguageServer": true,
"go.vetOnSave": "package",
// "go.languageServerExperimentalFeatures": {
// "diagnostics": true,
// },
"go.lintOnSave": "file",
"go.formatTool": "gofmt",
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast"
],
"go.toolsManagement.autoUpdate": true,
"gopls": {
"completeUnimported": true,
"formatting.gofumpt": true,
"completionDocumentation": true,
"ui.completion.usePlaceholders": true,
"build.expandWorkspaceToModule": true,
"build.experimentalWorkspaceModule": true,
"hoverKind": "SynopsisDocumentation" // No/Synopsis/Full, default Synopsis
},
}