Skip to content

Commit

Permalink
Update to Go 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckal777 committed Aug 15, 2023
1 parent 8b7d1a6 commit 419c74d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 42 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test_workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build and run tests
# This workflow is triggered on pushes to the repository.
on: [push, pull_request]
env:
GOTOOLCHAIN: local

jobs:
lint:
Expand All @@ -13,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
check-latest: true

- name: golangci-lint
Expand All @@ -32,7 +34,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
check-latest: true

- name: Install govulncheck
Expand All @@ -51,7 +53,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
check-latest: true

- name: Cache Go modules
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY go.sum go.sum
RUN go mod download

COPY ./ /workspace/
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on GOTOOLCHAIN=local go build -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
34 changes: 0 additions & 34 deletions common/errors.go

This file was deleted.

4 changes: 2 additions & 2 deletions controllers/node_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
package controllers

import (
"errors"
"fmt"
"time"

"github.com/sapcc/maintenance-controller/common"
"github.com/sapcc/maintenance-controller/constants"
"github.com/sapcc/maintenance-controller/metrics"
"github.com/sapcc/maintenance-controller/plugin"
Expand Down Expand Up @@ -105,7 +105,7 @@ func ApplyProfiles(params reconcileParameters, data *state.DataV2) error {
Labels: filterNodeLabels(params.node.Labels, params.config.DashboardLabelFilter),
})
if len(errs) > 0 {
return fmt.Errorf("failed to apply current state: %s", common.ConcatErrors(errs))
return fmt.Errorf("failed to apply current state: %s", errors.Join(errs...))

Check failure on line 108 in controllers/node_handler.go

View workflow job for this annotation

GitHub Actions / lint

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}
for i, ps := range profileStates {
result := profileResults[i]
Expand Down
4 changes: 2 additions & 2 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ package state

import (
"encoding/json"
"errors"
"fmt"
"strings"
"time"

"github.com/go-logr/logr"
"github.com/sapcc/maintenance-controller/common"
"github.com/sapcc/maintenance-controller/constants"
"github.com/sapcc/maintenance-controller/plugin"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -322,7 +322,7 @@ func transitionDefault(params plugin.Parameters, current NodeStateLabel, ts []Tr
Infos: results,
}
if len(errs) > 0 {
return final, fmt.Errorf("had failed transition checks: %s", common.ConcatErrors(errs))
return final, fmt.Errorf("had failed transition checks: %s", errors.Join(errs...))

Check failure on line 325 in state/state.go

View workflow job for this annotation

GitHub Actions / lint

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}
for i, result := range results {
if !result.Passed {
Expand Down

0 comments on commit 419c74d

Please sign in to comment.