diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 70e7577e3..f3b744ca2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,7 +20,7 @@ jobs: name: Test strategy: matrix: - go-version: [1.20.x, 1.21.x] + go-version: [1.22.x, 1.23.x] runs-on: ubuntu-latest steps: - name: Set up Go 1.x @@ -43,7 +43,7 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v3 with: - version: v1.55.1 + version: v1.61.0 args: -E=gofmt --timeout=30m0s regenerate: name: Regenerate @@ -54,7 +54,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v4 with: - go-version: 1.21.x + go-version: 1.23.x - name: Install schematyper run: | # "go install github.com/idubinskiy/schematyper:latest" fails with diff --git a/.github/workflows/ignition-validate.yml b/.github/workflows/ignition-validate.yml index 488bc1c48..30e7960e8 100644 --- a/.github/workflows/ignition-validate.yml +++ b/.github/workflows/ignition-validate.yml @@ -20,7 +20,7 @@ jobs: name: Test ignition-validate strategy: matrix: - go-version: [1.21.x] + go-version: [1.23.x] os: [macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/internal/exec/config_fetcher.go b/internal/exec/config_fetcher.go index 388e1b2aa..c486a3fb4 100644 --- a/internal/exec/config_fetcher.go +++ b/internal/exec/config_fetcher.go @@ -100,7 +100,7 @@ func (f *ConfigFetcher) fetchReferencedConfig(cfgRef types.Resource) (types.Conf return types.Config{}, err } var headers http.Header - if cfgRef.HTTPHeaders != nil && len(cfgRef.HTTPHeaders) > 0 { + if len(cfgRef.HTTPHeaders) > 0 { headers, err = cfgRef.HTTPHeaders.Parse() if err != nil { return types.Config{}, err diff --git a/internal/exec/engine.go b/internal/exec/engine.go index 0ae8b9854..54c8438aa 100644 --- a/internal/exec/engine.go +++ b/internal/exec/engine.go @@ -121,7 +121,7 @@ func (e Engine) Run(stageName string) error { return err } - e.Logger.PushPrefix(stageName) + e.Logger.PushPrefix(stageName) //nolint:govet defer e.Logger.PopPrefix() fullConfig := latest.Merge(baseConfig, latest.Merge(systemBaseConfig, cfg)) diff --git a/internal/exec/stages/files/files.go b/internal/exec/stages/files/files.go index ba6b9bf60..81d56aa16 100644 --- a/internal/exec/stages/files/files.go +++ b/internal/exec/stages/files/files.go @@ -164,7 +164,7 @@ func (s *stage) relabel(paths ...string) { // relabelFiles relabels all the files that were marked for relabeling using // the libselinux APIs. func (s *stage) relabelFiles() error { - if s.toRelabel == nil || len(s.toRelabel) == 0 { + if len(s.toRelabel) == 0 { return nil } diff --git a/internal/exec/util/file.go b/internal/exec/util/file.go index 6668945e8..3470be4e6 100644 --- a/internal/exec/util/file.go +++ b/internal/exec/util/file.go @@ -78,7 +78,7 @@ func newFetchOp(l *log.Logger, node types.Node, contents types.Resource) (FetchO } var headers http.Header - if contents.HTTPHeaders != nil && len(contents.HTTPHeaders) > 0 { + if len(contents.HTTPHeaders) > 0 { headers, err = contents.HTTPHeaders.Parse() if err != nil { return FetchOp{}, err diff --git a/internal/main.go b/internal/main.go index 80f854532..5cebe6a4f 100644 --- a/internal/main.go +++ b/internal/main.go @@ -89,7 +89,7 @@ func ignitionMain() { logger := log.New(flags.logToStdout) defer logger.Close() - logger.Info(version.String) + logger.Info(version.String) //nolint:govet logger.Info("Stage: %v", flags.stage) platformConfig := platform.MustGet(flags.platform.String()) @@ -157,7 +157,7 @@ func ignitionApplyMain() { logger := log.New(true) defer logger.Close() - logger.Info(version.String) + logger.Info(version.String) //nolint:govet var blob []byte var err error @@ -219,7 +219,7 @@ func ignitionRmCfgMain() { logger := log.New(flags.logToStdout) defer logger.Close() - logger.Info(version.String) + logger.Info(version.String) //nolint:govet platformConfig := platform.MustGet(flags.platform) fetcher, err := platformConfig.NewFetcher(&logger) diff --git a/internal/resource/http.go b/internal/resource/http.go index 872ce2531..12d4f862b 100644 --- a/internal/resource/http.go +++ b/internal/resource/http.go @@ -171,7 +171,7 @@ func (f *Fetcher) getCABlob(ca types.Resource) ([]byte, error) { } var headers http.Header - if ca.HTTPHeaders != nil && len(ca.HTTPHeaders) > 0 { + if len(ca.HTTPHeaders) > 0 { headers, err = ca.HTTPHeaders.Parse() if err != nil { return nil, err diff --git a/test b/test index d0be5e62f..14e9a2aff 100755 --- a/test +++ b/test @@ -44,7 +44,8 @@ PKG_VET=$(go list ./... | \ grep --invert-match internal/log) echo "Checking gofix..." -go tool fix -diff $SRC +go_version=$(go version | awk '{print $3}') +go tool fix -go="$go_version" -diff $SRC echo "Checking gofmt..." res=$(gofmt -d -e -s $SRC)