From 5e563b93a6057351e45b3489efc61d804d0842c3 Mon Sep 17 00:00:00 2001 From: Dominik Menke Date: Fri, 17 Nov 2023 21:40:44 +0100 Subject: [PATCH] ci: update test/lint pipeline Also correct some linter issues. --- .github/workflows/lint.yml | 4 ++-- .github/workflows/test.yml | 2 +- uci.go | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1abc70c..c1b7cf3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest env: - GO_VERSION: 1.16 + GO_VERSION: 1.21 steps: - name: Set up Go ${{ env.GO_VERSION }} @@ -40,4 +40,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.37 + version: v1.52 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4a64b2..f87a936 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - go-version: [1.13, 1.14, 1.15, 1.16, 1.x] + go-version: [1.20, 1.21, 1.x] steps: - name: Set up Go ${{ matrix.go-version }} diff --git a/uci.go b/uci.go index 4767ef2..7a0dc92 100644 --- a/uci.go +++ b/uci.go @@ -3,7 +3,6 @@ package uci import ( "fmt" "io" - "io/ioutil" "os" "path/filepath" "sync" @@ -118,7 +117,7 @@ func (t *tree) LoadConfig(name string, forceReload bool) error { // loadConfig actually reads a config file. Its call must be guarded by // locking the tree's mutex. func (t *tree) loadConfig(name string) error { - body, err := ioutil.ReadFile(filepath.Join(t.dir, name)) + body, err := os.ReadFile(filepath.Join(t.dir, name)) if err != nil { return fmt.Errorf("reading config file failed: %w", err) } @@ -359,7 +358,7 @@ func (t *tree) saveConfig(c *config) error { return err } - if err = f.Chmod(0644); err != nil { + if err = f.Chmod(0o644); err != nil { f.Close() _ = f.Remove() return fmt.Errorf("save: failed to set permissions: %w", err) @@ -391,7 +390,7 @@ type tmpFile interface { // newTmpFile purely exists to be replaced in tests. var newTmpFile = func(dir, pattern string) (tmpFile, error) { - f, err := ioutil.TempFile(dir, pattern) + f, err := os.CreateTemp(dir, pattern) if err != nil { return nil, fmt.Errorf("failed to create temp file: %w", err) }