Skip to content

Commit

Permalink
feat: Support Go 1.20 (#116)
Browse files Browse the repository at this point in the history
Adds support for Go 1.20 by using unstable stencil-golang and devbase.
This builds lintroller with Go 1.20 and should help with transient
issues using lintroller on Go 1.20 services.
  • Loading branch information
jaredallard authored Aug 15, 2023
1 parent 6ef1fec commit 1341256
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 20 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# syntax, such as anchors, will be fixed automatically.
version: 2.1
orbs:
shared: getoutreach/shared@2.17.0
shared: getoutreach/shared@dev:first
queue: eddiewebb/[email protected]

parameters:
Expand All @@ -16,7 +16,6 @@ contexts: &contexts
- ghaccesstoken
- docker-registry
- npm-credentials
- prismacloud-credentials
- vault-dev
- confluence
- circleci-credentials
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# you are reducing compatibility guarantees.
## <<Stencil::Block(toolverOverride)>>
## <</Stencil::Block>>
golang 1.19.11
terraform 1.4.4
protoc 21.5
nodejs 18.14.1
golang 1.20.7
# Note: Versions in this block do not override the default versions above
# but sometimes you have to declare additional versions of the same tool
# while leaving the 'default' version intact for the infra.
Expand Down
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
// Maps the go module cache on the host to the persistent volume used by devspaces.
// See the value of `go env GOMODCACHE` on the host and devspace.
{
"from": "${env:HOME}/.asdf/installs/golang/1.19.11/packages/pkg/mod",
"from": "${env:HOME}/.asdf/installs/golang/1.20.7/packages/pkg/mod",
"to": "/tmp/cache/go/mod/"
},
{
// Maps the standard library location on the host to the location in the devspace.
// This enables debugging standard library code.
"from": "${env:HOME}/.asdf/installs/golang/1.19.11/go/src",
"to": "/home/dev/.asdf/installs/golang/1.19.11/go/src"
"from": "${env:HOME}/.asdf/installs/golang/1.20.7/go/src",
"to": "/home/dev/.asdf/installs/golang/1.20.7/go/src"
}
]
},
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"go.buildTags": "or_dev",
"go.testTags": "or_test,or_int,or_e2e",
"files.trimTrailingWhitespace": true,
// This prevents 99% of issues with linters :)
"editor.formatOnSave": true,
"shellcheck.customArgs": ["-P", "SCRIPTDIR", "-x"],
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ module github.com/getoutreach/lintroller
go 1.19

require (
github.com/getoutreach/gobox v1.71.0
github.com/getoutreach/gobox v1.73.2
github.com/pkg/errors v0.9.1
golang.org/x/tools v0.12.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.0
)

require github.com/rogpeppe/go-internal v1.9.0 // indirect
require (
github.com/kr/pretty v0.3.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
)

require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/kr/text v0.2.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.11.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
Expand Down
9 changes: 7 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion opslevel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ service:
- key: stencil_version
value: "v1.36.0"
- key: golang_version
value: "1.19.11"
value: "1.20.7"
- key: cli
value: "false"
- key: service
Expand Down
35 changes: 29 additions & 6 deletions scripts/golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,42 @@ linters-settings:
govet:
check-shadowing: true
revive:
confidence: 0
rules:
# Enable the default golint rules. We must include these because
# we configure a single rule, which disables the default rules.
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unreachable-code
- name: redefines-builtin-id
# While we agree with this rule, right now it would break too many
# projects. So, we disable it by default.
- name: unused-parameter
disabled: true
gocyclo:
min-complexity: 25
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 3
min-occurrences: 3
misspell:
locale: US
lll:
line-length: 140
gocritic:
Expand Down Expand Up @@ -84,7 +108,6 @@ issues:
linters:
- gocyclo
- errcheck
- dupl
- gosec
- funlen
- gochecknoglobals # Globals in test files are tolerated.
Expand Down
3 changes: 3 additions & 0 deletions service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ arguments:
modules:
- name: github.com/getoutreach/stencil-base
- name: github.com/getoutreach/stencil-golang
channel: unstable
- name: github.com/getoutreach/devbase
channel: main
- name: github.com/getoutreach/stencil-outreach
- name: github.com/getoutreach/stencil-circleci
- name: github.com/getoutreach/stencil-actions
Expand Down
4 changes: 2 additions & 2 deletions stencil.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: v1.36.0
modules:
- name: github.com/getoutreach/devbase
url: https://github.com/getoutreach/devbase
version: v2.17.0
version: main
- name: github.com/getoutreach/stencil-actions
url: https://github.com/getoutreach/stencil-actions
version: v0.3.0
Expand All @@ -17,7 +17,7 @@ modules:
version: v1.8.0
- name: github.com/getoutreach/stencil-golang
url: https://github.com/getoutreach/stencil-golang
version: v1.13.2
version: unstable
- name: github.com/getoutreach/stencil-outreach
url: https://github.com/getoutreach/stencil-outreach
version: v0.12.2
Expand Down

0 comments on commit 1341256

Please sign in to comment.