Skip to content

Commit

Permalink
⬆️ Updated Golang to 1.20.0 (#25)
Browse files Browse the repository at this point in the history
* 🧑‍💻 Upgraded devcontainer to 1.20

* 🔧 Updated Github Flows to 1.20

* ⬆️ 💡 Golang to 1.20

Also added some clarifying comments

* 👽 Updated Config to honour new spec
  • Loading branch information
Templum committed Feb 18, 2023
1 parent 45455fd commit df3c331
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go/.devcontainer/base.Dockerfile

# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster
ARG VARIANT="1.19-bullseye"
ARG VARIANT="1.20-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
Expand Down
72 changes: 38 additions & 34 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"VARIANT": "1.19-bullseye",
"VARIANT": "1.20-bullseye",
// Options
"NODE_VERSION": "none"
}
Expand All @@ -18,42 +18,46 @@
"--security-opt",
"seccomp=unconfined"
],
// Set *default* container specific settings.json values on container create.
"settings": {
"go.gocodeAutoBuild": false,
"files.autoSave": "afterDelay",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go",
"go.toolsGopath": "/go/bin",
"go.buildOnSave": "workspace",
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.coverOnSave": false,
"go.useCodeSnippetsOnFunctionSuggest": false,
"go.lintTool": "golangci-lint",
"go.formatTool": "goimports",
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"[go.mod]": {
"editor.minimap.enabled": false
},
"[go.sum]": {
"editor.minimap.enabled": false
"customizations": {
"vscode": {
"settings": {
"go.gocodeAutoBuild": false,
"files.autoSave": "afterDelay",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go",
"go.toolsGopath": "/go/bin",
"go.buildOnSave": "workspace",
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.coverOnSave": false,
"go.useCodeSnippetsOnFunctionSuggest": false,
"go.lintTool": "golangci-lint",
"go.formatTool": "goimports",
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"[go.mod]": {
"editor.minimap.enabled": false
},
"[go.sum]": {
"editor.minimap.enabled": false
}
},
"extensions": [
"golang.Go",
"streetsidesoftware.code-spell-checker",
"premparihar.gotestexplorer",
"wayou.vscode-todo-highlight",
"bierner.github-markdown-preview"
]
}
},
// Set *default* container specific settings.json values on container create.
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"streetsidesoftware.code-spell-checker",
"premparihar.gotestexplorer",
"wayou.vscode-todo-highlight",
"bierner.github-markdown-preview"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.0
- name: Compile Action
run: go build -v ./...
unit-testing:
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.0
- name: Run Unit Test with Racecondition Detector
run: go test -race ./...
- name: Run Unit Tests with Coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: Templum/govulncheck-action@main
with:
skip-upload: true
go-version: 1.19
go-version: 1.20.0
env:
GH_PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
GOPRIVATE: "github.com/Templum/private-lib"
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG GOLANG_VERSION=1.19
FROM golang:1.19 as builder
# This golang version is for the builder only
FROM golang:1.20 as builder

WORKDIR /go/src/github.com/Templum/govulncheck-action/
ENV GO111MODULE=on
Expand All @@ -9,16 +10,15 @@ RUN go mod download

COPY . .

# Statically compile our app for use in a distroless container
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -v -o action .

# This golang version determines in which golang environment the customer code is checked
FROM golang:$GOLANG_VERSION
ARG VULNCHECK_VERSION=latest
RUN go install golang.org/x/vuln/cmd/govulncheck@$VULNCHECK_VERSION

# This allows private repositories hosted on Github
ARG GH_PAT_TOKEN
RUN if [[ -n "$GH_PAT_TOKEN" ]]; then echo "No token was provided"; else git config --global --add url."https://govulncheck_action:$GH_PAT_TOKEN@github.com/".insteadOf "https://github.com/"; fi

ARG GOPRIVATE
ENV GOPRIVATE=$GOPRIVATE

Expand Down

0 comments on commit df3c331

Please sign in to comment.