Skip to content

Commit

Permalink
chore: upgrade Golang to 1.23 and Linter (#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
tommartensen authored Dec 20, 2024
1 parent 2ad31be commit 32ca82b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/PR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ jobs:
USE_GKE_GCLOUD_AUTH_PLUGIN: "True"

steps:
- uses: actions/setup-go@v5
with:
go-version: "1.23"

- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.23"
- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
version: v1.62

shellcheck:
runs-on: ubuntu-latest
Expand Down
15 changes: 7 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
run:
timeout: 16m
go: "1.23"

output:
format: "junit-xml:report.xml,colored-line-number"
formats:
- format: colored-line-number
- format: junit-xml
path: report.xml

issues:
exclude-use-default: false
Expand Down Expand Up @@ -36,7 +40,7 @@ linters-settings:
includes:
- G601
revive:
min-confidence: 0
confidence: 0
govet:
enable-all: true
disable:
Expand All @@ -56,16 +60,11 @@ linters-settings:
- Warnf
- Error
- Errorf
gocritic:
enabled-checks:
- commentFormatting
nolintlint:
allow-leading-space: false # require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
staticcheck:
go: "1.20"
checks: [all, -ST1000, -ST1001, -ST1003, -ST1005, -SA1019, -SA4001, -ST1016]
wrapcheck:
ignoreSigRegexps:
Expand All @@ -81,6 +80,7 @@ linters:
enable:
- asciicheck
# - bodyclose
- copyloopvar
# - deadcode
# - depguard
# - dogsled
Expand All @@ -92,7 +92,6 @@ linters:
# - gochecknoinits
# - gocognit
# - goconst
- exportloopref
- gocritic
# - gocyclo
# - godot
Expand Down
2 changes: 1 addition & 1 deletion auth/tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (c oidcClaims) Valid() error {
case !strings.HasSuffix(c.Email, emailSuffixRedHat):
errMsg := "email address does not belong to Red Hat"
log.AuditLog(logging.INFO, "oidc-claim-validation", errMsg, "email", c.Email)
return errors.Errorf(errMsg)
return errors.New(errMsg)
default:
// Use an empty jwt.Expected to skip non-time-related validation and use time.Now()
// for the validation.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/stackrox/infra

go 1.22
go 1.23

toolchain go1.22.5
toolchain go1.23.1

require (
cloud.google.com/go/bigquery v1.60.0
Expand Down
4 changes: 2 additions & 2 deletions scripts/local-dev/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/stackrox/infra/scripts/local-dev

go 1.22
go 1.23

toolchain go1.22.5
toolchain go1.23.1

require gopkg.in/yaml.v2 v2.4.0
2 changes: 0 additions & 2 deletions service/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ func (s *clusterImpl) List(ctx context.Context, request *v1.ClusterListRequest)
// Loop over all of the workflows, and keep only the ones that match our
// request criteria.
for _, workflow := range workflowList.Items {
workflow := workflow

// This cluster is expired, and we did not request to include expired
// clusters.
if !request.Expired && isWorkflowExpired(workflow) {
Expand Down
1 change: 0 additions & 1 deletion service/flavor.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func NewFlavorService(registry *flavor.Registry) (middleware.APIService, error)
func (s *flavorImpl) List(_ context.Context, request *v1.FlavorListRequest) (*v1.FlavorListResponse, error) {
var resp v1.FlavorListResponse
for _, flavor := range s.registry.Flavors() {
flavor := flavor
if !request.All && flavor.Availability == v1.Flavor_alpha {
continue
}
Expand Down

0 comments on commit 32ca82b

Please sign in to comment.