From 2f23c0bd75e564995db8792a65a9cb587c01ddb5 Mon Sep 17 00:00:00 2001 From: CoreOS Bot Date: Fri, 11 Oct 2024 14:59:52 +0000 Subject: [PATCH 1/3] =?UTF-8?q?Sync=20repo=20templates=20=E2=9A=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sync with coreos/repo-templates@91391bc86328adbabb729407cd098a1930c5ade1. --- .github/workflows/go.yml | 6 +++--- .github/workflows/ignition-validate.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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: From d9331fc641539aab4290f40e174c41b15bdf71bb Mon Sep 17 00:00:00 2001 From: Steven Presti Date: Fri, 11 Oct 2024 11:16:11 -0400 Subject: [PATCH 2/3] test: add -go flag to go tool fix As of 1.22.7 golang's go tool fix no longer self populates. you can see the changes here: https://github.com/golang/go/commit/676d6100d89fb8527c42f072bc7b7a9b98700f84#diff-a4f750f77a9e274ac048407886b3e210cdde1543878d681a6fa96b9d2ec49c23R69 fixes: #1950 --- test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) From 47b8dee93f4ed9857e38fefab3b447b6d73f8e45 Mon Sep 17 00:00:00 2001 From: Steven Presti Date: Fri, 11 Oct 2024 11:18:18 -0400 Subject: [PATCH 3/3] linting: update src to comply with new linting version With the newer version of the linter some code has been flagged. Add code changes where possible and ignores when needed. --- internal/exec/config_fetcher.go | 2 +- internal/exec/engine.go | 2 +- internal/exec/stages/files/files.go | 2 +- internal/exec/util/file.go | 2 +- internal/main.go | 6 +++--- internal/resource/http.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) 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