Skip to content

Commit 5aaf062

Browse files
authored
Merge pull request #2 from adrienaury/refactor
Refactor
2 parents e052317 + 0bb0925 commit 5aaf062

16 files changed

Lines changed: 1201 additions & 266 deletions

.devcontainer/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
FROM qmcgaw/godevcontainer:alpine
1+
FROM adrienaury/go-devcontainer:v0.2
22

33
RUN sudo apk add --update make gomplate
4-
RUN wget -O- -nv https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin
5-
RUN wget -O- -nv https://install.goreleaser.com/github.com/caarlos0/svu.sh | sudo sh -s -- -b /usr/local/bin

.devcontainer/devcontainer.json

Lines changed: 63 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "CHANGE IT",
23
"dockerComposeFile": [
34
"../docker-compose.yml"
45
],
@@ -7,38 +8,26 @@
78
"vscode"
89
],
910
"shutdownAction": "stopCompose",
10-
"postCreateCommand": "make info",
11+
"postCreateCommand": "make init",
1112
"workspaceFolder": "/workspace",
1213
"remoteEnv": {
1314
"PATH": "${containerEnv:PATH}:/workspace/bin/"
1415
},
1516
"extensions": [
16-
// General backend
17-
"mohsen1.prettify-json",
18-
"bajdzis.vscode-database", // Supports connections to mysql or postgres, over SSL, socked
19-
"redhat.vscode-yaml", // Kubernetes and Kedge syntax support
20-
// Go
21-
"golang.go",
22-
// Console
23-
"IBM.output-colorizer",
24-
// Git
25-
"eamodio.gitlens",
26-
"mhutchie.git-graph",
27-
// Other linters
28-
"davidanson.vscode-markdownlint",
29-
"ms-azuretools.vscode-docker",
30-
// Other helpers
31-
"shardulm94.trailing-spaces",
32-
"Gruntfuggly.todo-tree",
33-
"bierner.emojisense",
34-
"stkb.rewrap", // rewrap comments after n characters on one line
35-
// Other
36-
"jrebocho.vscode-random", // generate random values
37-
"alefragnani.Bookmarks",
38-
"quicktype.quicktype", // Paste JSON as code
39-
"spikespaz.vscode-smoothtype", // smooth cursor animation
40-
"vscode-icons-team.vscode-icons",
41-
"github.vscode-pull-request-github"
17+
"golang.Go",
18+
"eamodio.gitlens",
19+
"donjayamanne.githistory",
20+
"DavidAnson.vscode-markdownlint",
21+
"esbenp.prettier-vscode",
22+
"yzhang.markdown-all-in-one",
23+
"ms-azuretools.vscode-docker",
24+
"shardulm94.trailing-spaces",
25+
"vscode-icons-team.vscode-icons",
26+
"johnpapa.vscode-peacock",
27+
"aaron-bond.better-comments",
28+
"quicktype.quicktype",
29+
"spikespaz.vscode-smoothtype",
30+
"EditorConfig.EditorConfig",
4231
],
4332
"settings": {
4433
// General settings
@@ -60,98 +49,52 @@
6049
"go.lintTool": "golangci-lint",
6150
"go.lintFlags": [
6251
"--fast",
63-
"--enable",
64-
"asciicheck",
65-
"--enable",
66-
"bodyclose",
67-
"--enable",
68-
"deadcode",
69-
"--enable",
70-
"dogsled",
71-
"--enable",
72-
"dupl",
73-
"--enable",
74-
"errcheck",
75-
"--enable",
76-
"exhaustive",
77-
"--enable",
78-
"exportloopref",
79-
"--enable",
80-
"gci",
81-
"--enable",
82-
"gochecknoglobals",
83-
"--enable",
84-
"gochecknoinits",
85-
"--enable",
86-
"gocognit",
87-
"--enable",
88-
"goconst",
89-
"--enable",
90-
"gocritic",
91-
"--enable",
92-
"gocyclo",
93-
"--enable",
94-
"godot",
95-
"--enable",
96-
"goerr113",
97-
"--enable",
98-
"goheader",
99-
"--enable",
100-
"goimports",
101-
"--enable",
102-
"golint",
103-
"--enable",
104-
"gomnd",
105-
"--enable",
106-
"goprintffuncname",
107-
"--enable",
108-
"gosec",
109-
"--enable",
110-
"gosimple",
111-
"--enable",
112-
"govet",
113-
"--enable",
114-
"ineffassign",
115-
"--enable",
116-
"interfacer",
117-
"--enable",
118-
"lll",
119-
"--enable",
120-
"maligned",
121-
"--enable",
122-
"misspell",
123-
"--enable",
124-
"nakedret",
125-
"--enable",
126-
"nestif",
127-
"--enable",
128-
"noctx",
129-
"--enable",
130-
"nolintlint",
131-
"--enable",
132-
"prealloc",
133-
"--enable",
134-
"rowserrcheck",
135-
"--enable",
136-
"scopelint",
137-
"--enable",
138-
"sqlclosecheck",
139-
"--enable",
140-
"staticcheck",
141-
"--enable",
142-
"structcheck",
143-
"--enable",
144-
"typecheck",
145-
"--enable",
146-
"unconvert",
147-
"--enable",
148-
"unparam",
149-
"--enable",
150-
"unused",
151-
"--enable",
152-
"varcheck",
153-
"--enable",
154-
"whitespace",
52+
"--enable", "asciicheck",
53+
"--enable", "bodyclose",
54+
"--enable", "deadcode",
55+
"--enable", "dogsled",
56+
"--enable", "dupl",
57+
"--enable", "errcheck",
58+
"--enable", "exhaustive",
59+
"--enable", "exportloopref",
60+
"--enable", "gci",
61+
"--enable", "gochecknoglobals",
62+
"--enable", "gochecknoinits",
63+
"--enable", "gocognit",
64+
"--enable", "goconst",
65+
"--enable", "gocritic",
66+
"--enable", "gocyclo",
67+
"--enable", "godot",
68+
"--enable", "goerr113",
69+
"--enable", "goheader",
70+
"--enable", "goimports",
71+
"--enable", "golint",
72+
"--enable", "gomnd",
73+
"--enable", "goprintffuncname",
74+
"--enable", "gosec",
75+
"--enable", "gosimple",
76+
"--enable", "govet",
77+
"--enable", "ineffassign",
78+
"--enable", "interfacer",
79+
"--enable", "lll",
80+
"--enable", "maligned",
81+
"--enable", "misspell",
82+
"--enable", "nakedret",
83+
"--enable", "nestif",
84+
"--enable", "noctx",
85+
"--enable", "nolintlint",
86+
"--enable", "prealloc",
87+
"--enable", "rowserrcheck",
88+
"--enable", "scopelint",
89+
"--enable", "sqlclosecheck",
90+
"--enable", "staticcheck",
91+
"--enable", "structcheck",
92+
"--enable", "typecheck",
93+
"--enable", "unconvert",
94+
"--enable", "unparam",
95+
"--enable", "unused",
96+
"--enable", "varcheck",
97+
"--enable", "whitespace",
15598
],
15699
// Golang on save
157100
"go.buildOnSave": "workspace",
@@ -164,13 +107,6 @@
164107
}
165108
},
166109
// Golang testing
167-
"go.toolsEnvVars": {
168-
"GOFLAGS": "-tags=integration"
169-
},
170-
"gopls.env": {
171-
"GOFLAGS": "-tags=integration"
172-
},
173-
"go.testEnvVars": {},
174110
"go.testFlags": [
175111
"-v"
176112
],
@@ -179,4 +115,4 @@
179115
"go.coverOnSingleTestFile": true,
180116
"go.coverShowCounts": true,
181117
}
182-
}
118+
}

.editorconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.go]
12+
indent_style = tab
13+
14+
[{Makefile, *.mk}]
15+
indent_style = tab
16+
17+
[*.{yaml,yml}]
18+
indent_size = 2
19+
20+
[*.{md,txt}]
21+
indent_style = space
22+
indent_size = 4

.goreleaser.template.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ before:
55
- go mod download
66
dist: bin/dist
77
builds:
8-
{{range (file.ReadDir "cmd")}}
8+
{{range (getenv "BUILDPATHS" | jsonArray)}}
99
- id: "{{.}}"
10-
binary: "{{.}}"
11-
main: "./cmd/{{.}}"
10+
binary: "{{ path.Base . }}"
11+
main: "./{{.}}"
1212
goos:
1313
- darwin
1414
- linux
1515
- windows
1616
ldflags:
17-
- -s -w -X main.name={{.}} -X main.version={{env.Getenv "VERSION"}} -X main.commit={{env.Getenv "COMMIT_HASH"}} -X main.builtBy=goreleaser
18-
- -X main.buildDate={{env.Getenv "BUILD_DATE"}}
17+
- -s -w -X main.name={{ path.Base . }} {{env.Getenv "LDFLAGS"}}
1918
{{end}}

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#fbed80",
4+
"activityBar.activeBorder": "#06b9a5",
5+
"activityBar.background": "#fbed80",
6+
"activityBar.foreground": "#15202b",
7+
"activityBar.inactiveForeground": "#15202b99",
8+
"activityBarBadge.background": "#06b9a5",
9+
"activityBarBadge.foreground": "#15202b",
10+
"statusBar.background": "#f9e64f",
11+
"statusBar.foreground": "#15202b",
12+
"statusBarItem.hoverBackground": "#f7df1e",
13+
"titleBar.activeBackground": "#f9e64f",
14+
"titleBar.activeForeground": "#15202b",
15+
"titleBar.inactiveBackground": "#f9e64f99",
16+
"titleBar.inactiveForeground": "#15202b99"
17+
},
18+
"peacock.remoteColor": "#f9e64f"
19+
}

CONTRIB.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
# Contributing
22

3-
## Create a local docker volume with sources
4-
5-
```console
6-
docker volume create --driver local -o o=bind -o type=none -o device=/path/to/docker-credential-localuser docker-credential-localuser-sources
7-
```
8-
9-
## Create a .env file
10-
11-
```.env
12-
GITHUB_USER=<your github user>
13-
GITHUB_REPO=<your github repo>
14-
GITHUB_TOKEN=<your github token>
15-
```
16-
173
## TODO
184

195
- how to submit a contribution ?

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM gcr.io/distroless/base
22
ARG BIN
3-
COPY /bin/${BIN} /entrypoint
4-
CMD ["/entrypoint"]
3+
COPY /bin/cli /cli
4+
CMD ["/cli"]

Dockerfile.webserver

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM gcr.io/distroless/base
22
ARG BIN
3-
COPY /bin/${BIN} /entrypoint
3+
COPY /bin/webserver /webserver
44
EXPOSE 8080
5-
CMD ["/entrypoint"]
5+
CMD ["/webserver"]

0 commit comments

Comments
 (0)