Skip to content

Commit d6e014b

Browse files
committed
Init
- Go 1.14.2 - Mage 1.9.0 - GolangCI-Lint 1.26.0 - Add Visual Studio Code with Remote Containers support - Add GitHub Actions workflow using Docker Compose
0 parents  commit d6e014b

18 files changed

+353
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or
2+
// https://github.com/microsoft/vscode-dev-containers
3+
{
4+
"name": "Go",
5+
"context": "..",
6+
"dockerFile": "../Dockerfile",
7+
"runArgs": [
8+
"--cap-add=SYS_PTRACE",
9+
"--security-opt",
10+
"seccomp=unconfined"
11+
],
12+
// Set *default* container specific settings.json values on container create.
13+
"settings": {
14+
"terminal.integrated.shell.linux": "/bin/bash",
15+
"go.gopath": "/go"
16+
},
17+
// Add the IDs of extensions you want installed when the container is created.
18+
"extensions": [
19+
"ms-vscode.go"
20+
],
21+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
22+
// "forwardPorts": [],
23+
// Use 'postCreateCommand' to run commands after the container is created.
24+
"postCreateCommand": "apt-get update && apt-get install -y git"
25+
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
26+
// "remoteUser": "vscode"
27+
}

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
*.{cmd,[cC][mM][dD]} text eol=crlf
3+
*.{bat,[bB][aA][tT]} text eol=crlf

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: build
2+
on: push
3+
jobs:
4+
docker-compose:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- name: Build
9+
run: docker-compose up --abort-on-container-exit

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
# Visual Studio Code files
18+
.vscode/*
19+
!.vscode/settings.json
20+
!.vscode/tasks.json
21+
!.vscode/launch.json
22+
!.vscode/extensions.json
23+
*.code-workspace
24+
25+
# Local History for Visual Studio Code
26+
.history/

.golangci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
linters-settings:
2+
goimports:
3+
local-prefixes: github.com/golang-templates/library
4+
golint:
5+
min-confidence: 0
6+
misspell:
7+
locale: US
8+
nolintlint:
9+
allow-leading-space: false # don't require machine-readable nolint directives (i.e. with no leading space)
10+
allow-unused: false # report any unused nolint directives
11+
require-explanation: true # don't require an explanation for nolint directives
12+
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
13+
14+
linters:
15+
# please, do not use `enable-all`: it's deprecated and will be removed soon.
16+
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
17+
disable-all: true
18+
enable:
19+
# default linters:
20+
- deadcode
21+
- errcheck
22+
- gosimple
23+
- govet
24+
- ineffassign
25+
- staticcheck
26+
- structcheck
27+
- typecheck
28+
- unused
29+
- varcheck
30+
# linters disabled by default:
31+
- asciicheck
32+
- bodyclose
33+
- depguard
34+
- dogsled
35+
- dupl
36+
- funlen
37+
- gochecknoglobals
38+
- gochecknoinits
39+
- gocognit
40+
- goconst
41+
- gocritic
42+
- gocyclo
43+
- godot
44+
- godox
45+
- goerr113
46+
- gofmt
47+
- goimports
48+
- golint
49+
- gomnd
50+
- gomodguard
51+
- goprintffuncname
52+
- gosec
53+
- interfacer
54+
- lll
55+
- maligned
56+
- misspell
57+
- nakedret
58+
- nestif
59+
- nolintlint
60+
- prealloc
61+
- rowserrcheck
62+
- scopelint
63+
- stylecheck
64+
- testpackage
65+
- unconvert
66+
- unparam
67+
- whitespace
68+
- wsl

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"ms-vscode.go"
4+
]
5+
}

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}",
13+
"env": {},
14+
"args": []
15+
}
16+
]
17+
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// gopls
3+
"go.useLanguageServer": true,
4+
// golangci-lint
5+
"go.lintTool": "golangci-lint",
6+
"go.lintFlags": [
7+
"--fast"
8+
]
9+
}

.vscode/tasks.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "All",
8+
"type": "shell",
9+
"command": "mage -v all",
10+
"problemMatcher": [
11+
"$go"
12+
],
13+
"group": "build"
14+
},
15+
{
16+
"label": "Build",
17+
"type": "shell",
18+
"command": "mage -v build",
19+
"problemMatcher": [
20+
"$go"
21+
],
22+
"group": "build"
23+
},
24+
{
25+
"label": "Lint",
26+
"type": "shell",
27+
"command": "mage -v lint",
28+
"problemMatcher": [
29+
"$go"
30+
],
31+
"group": "build"
32+
},
33+
{
34+
"label": "Test",
35+
"type": "shell",
36+
"command": "mage -v test",
37+
"problemMatcher": [
38+
"$go"
39+
],
40+
"group": "build"
41+
}
42+
]
43+
}

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Go
2+
FROM golang:1.14.2
3+
# mage
4+
RUN GO111MODULE=on go get github.com/magefile/[email protected]
5+
# golangci-lint
6+
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0

0 commit comments

Comments
 (0)