Skip to content

Commit

Permalink
Merge pull request #2 from adrienaury/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
adrienaury authored May 2, 2021
2 parents e052317 + 0bb0925 commit 5aaf062
Show file tree
Hide file tree
Showing 16 changed files with 1,201 additions and 266 deletions.
4 changes: 1 addition & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
FROM qmcgaw/godevcontainer:alpine
FROM adrienaury/go-devcontainer:v0.2

RUN sudo apk add --update make gomplate
RUN wget -O- -nv https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin
RUN wget -O- -nv https://install.goreleaser.com/github.com/caarlos0/svu.sh | sudo sh -s -- -b /usr/local/bin
190 changes: 63 additions & 127 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "CHANGE IT",
"dockerComposeFile": [
"../docker-compose.yml"
],
Expand All @@ -7,38 +8,26 @@
"vscode"
],
"shutdownAction": "stopCompose",
"postCreateCommand": "make info",
"postCreateCommand": "make init",
"workspaceFolder": "/workspace",
"remoteEnv": {
"PATH": "${containerEnv:PATH}:/workspace/bin/"
},
"extensions": [
// General backend
"mohsen1.prettify-json",
"bajdzis.vscode-database", // Supports connections to mysql or postgres, over SSL, socked
"redhat.vscode-yaml", // Kubernetes and Kedge syntax support
// Go
"golang.go",
// Console
"IBM.output-colorizer",
// Git
"eamodio.gitlens",
"mhutchie.git-graph",
// Other linters
"davidanson.vscode-markdownlint",
"ms-azuretools.vscode-docker",
// Other helpers
"shardulm94.trailing-spaces",
"Gruntfuggly.todo-tree",
"bierner.emojisense",
"stkb.rewrap", // rewrap comments after n characters on one line
// Other
"jrebocho.vscode-random", // generate random values
"alefragnani.Bookmarks",
"quicktype.quicktype", // Paste JSON as code
"spikespaz.vscode-smoothtype", // smooth cursor animation
"vscode-icons-team.vscode-icons",
"github.vscode-pull-request-github"
"golang.Go",
"eamodio.gitlens",
"donjayamanne.githistory",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"yzhang.markdown-all-in-one",
"ms-azuretools.vscode-docker",
"shardulm94.trailing-spaces",
"vscode-icons-team.vscode-icons",
"johnpapa.vscode-peacock",
"aaron-bond.better-comments",
"quicktype.quicktype",
"spikespaz.vscode-smoothtype",
"EditorConfig.EditorConfig",
],
"settings": {
// General settings
Expand All @@ -60,98 +49,52 @@
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast",
"--enable",
"asciicheck",
"--enable",
"bodyclose",
"--enable",
"deadcode",
"--enable",
"dogsled",
"--enable",
"dupl",
"--enable",
"errcheck",
"--enable",
"exhaustive",
"--enable",
"exportloopref",
"--enable",
"gci",
"--enable",
"gochecknoglobals",
"--enable",
"gochecknoinits",
"--enable",
"gocognit",
"--enable",
"goconst",
"--enable",
"gocritic",
"--enable",
"gocyclo",
"--enable",
"godot",
"--enable",
"goerr113",
"--enable",
"goheader",
"--enable",
"goimports",
"--enable",
"golint",
"--enable",
"gomnd",
"--enable",
"goprintffuncname",
"--enable",
"gosec",
"--enable",
"gosimple",
"--enable",
"govet",
"--enable",
"ineffassign",
"--enable",
"interfacer",
"--enable",
"lll",
"--enable",
"maligned",
"--enable",
"misspell",
"--enable",
"nakedret",
"--enable",
"nestif",
"--enable",
"noctx",
"--enable",
"nolintlint",
"--enable",
"prealloc",
"--enable",
"rowserrcheck",
"--enable",
"scopelint",
"--enable",
"sqlclosecheck",
"--enable",
"staticcheck",
"--enable",
"structcheck",
"--enable",
"typecheck",
"--enable",
"unconvert",
"--enable",
"unparam",
"--enable",
"unused",
"--enable",
"varcheck",
"--enable",
"whitespace",
"--enable", "asciicheck",
"--enable", "bodyclose",
"--enable", "deadcode",
"--enable", "dogsled",
"--enable", "dupl",
"--enable", "errcheck",
"--enable", "exhaustive",
"--enable", "exportloopref",
"--enable", "gci",
"--enable", "gochecknoglobals",
"--enable", "gochecknoinits",
"--enable", "gocognit",
"--enable", "goconst",
"--enable", "gocritic",
"--enable", "gocyclo",
"--enable", "godot",
"--enable", "goerr113",
"--enable", "goheader",
"--enable", "goimports",
"--enable", "golint",
"--enable", "gomnd",
"--enable", "goprintffuncname",
"--enable", "gosec",
"--enable", "gosimple",
"--enable", "govet",
"--enable", "ineffassign",
"--enable", "interfacer",
"--enable", "lll",
"--enable", "maligned",
"--enable", "misspell",
"--enable", "nakedret",
"--enable", "nestif",
"--enable", "noctx",
"--enable", "nolintlint",
"--enable", "prealloc",
"--enable", "rowserrcheck",
"--enable", "scopelint",
"--enable", "sqlclosecheck",
"--enable", "staticcheck",
"--enable", "structcheck",
"--enable", "typecheck",
"--enable", "unconvert",
"--enable", "unparam",
"--enable", "unused",
"--enable", "varcheck",
"--enable", "whitespace",
],
// Golang on save
"go.buildOnSave": "workspace",
Expand All @@ -164,13 +107,6 @@
}
},
// Golang testing
"go.toolsEnvVars": {
"GOFLAGS": "-tags=integration"
},
"gopls.env": {
"GOFLAGS": "-tags=integration"
},
"go.testEnvVars": {},
"go.testFlags": [
"-v"
],
Expand All @@ -179,4 +115,4 @@
"go.coverOnSingleTestFile": true,
"go.coverShowCounts": true,
}
}
}
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.go]
indent_style = tab

[{Makefile, *.mk}]
indent_style = tab

[*.{yaml,yml}]
indent_size = 2

[*.{md,txt}]
indent_style = space
indent_size = 4
9 changes: 4 additions & 5 deletions .goreleaser.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ before:
- go mod download
dist: bin/dist
builds:
{{range (file.ReadDir "cmd")}}
{{range (getenv "BUILDPATHS" | jsonArray)}}
- id: "{{.}}"
binary: "{{.}}"
main: "./cmd/{{.}}"
binary: "{{ path.Base . }}"
main: "./{{.}}"
goos:
- darwin
- linux
- windows
ldflags:
- -s -w -X main.name={{.}} -X main.version={{env.Getenv "VERSION"}} -X main.commit={{env.Getenv "COMMIT_HASH"}} -X main.builtBy=goreleaser
- -X main.buildDate={{env.Getenv "BUILD_DATE"}}
- -s -w -X main.name={{ path.Base . }} {{env.Getenv "LDFLAGS"}}
{{end}}
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#fbed80",
"activityBar.activeBorder": "#06b9a5",
"activityBar.background": "#fbed80",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#06b9a5",
"activityBarBadge.foreground": "#15202b",
"statusBar.background": "#f9e64f",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#f7df1e",
"titleBar.activeBackground": "#f9e64f",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#f9e64f99",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.remoteColor": "#f9e64f"
}
14 changes: 0 additions & 14 deletions CONTRIB.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
# Contributing

## Create a local docker volume with sources

```console
docker volume create --driver local -o o=bind -o type=none -o device=/path/to/docker-credential-localuser docker-credential-localuser-sources
```

## Create a .env file

```.env
GITHUB_USER=<your github user>
GITHUB_REPO=<your github repo>
GITHUB_TOKEN=<your github token>
```

## TODO

- how to submit a contribution ?
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gcr.io/distroless/base
ARG BIN
COPY /bin/${BIN} /entrypoint
CMD ["/entrypoint"]
COPY /bin/cli /cli
CMD ["/cli"]
4 changes: 2 additions & 2 deletions Dockerfile.webserver
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM gcr.io/distroless/base
ARG BIN
COPY /bin/${BIN} /entrypoint
COPY /bin/webserver /webserver
EXPOSE 8080
CMD ["/entrypoint"]
CMD ["/webserver"]
Loading

0 comments on commit 5aaf062

Please sign in to comment.