diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 801b8b8ca..df3133082 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - go-version: [ '1.21', '1.22' ] + go-version: [ oldstable, stable ] os: [ubuntu-latest, macos-latest, windows-latest] include: @@ -29,36 +29,18 @@ jobs: go-path-suffix: \go steps: - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - stable: true - # https://github.com/marketplace/actions/checkout - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: go/src/github.com/traefik/yaegi - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v5 with: - # In order: - # * Module download cache - # * Build cache (Linux) - # * Build cache (Mac) - # * Build cache (Windows) - path: | - ~/go/pkg/mod - ~/.cache/go-build - ~/Library/Caches/go-build - %LocalAppData%\go-build - key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.go-version }}-go- + go-version: ${{ matrix.go-version }} + stable: true - name: Setup GOPATH run: go env -w GOPATH=${{ github.workspace }}${{ matrix.go-path-suffix }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cae47a844..de3c74e36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,8 +7,8 @@ on: pull_request: env: - GO_VERSION: '1.22' - GOLANGCI_LINT_VERSION: v1.55.2 + GO_VERSION: stable + GOLANGCI_LINT_VERSION: v1.56.2 jobs: @@ -16,16 +16,16 @@ jobs: name: Linting runs-on: ubuntu-latest steps: - - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - name: Check and get dependencies run: | go mod tidy @@ -45,19 +45,19 @@ jobs: needs: linting strategy: matrix: - go-version: [ '1.21', '1.22' ] + go-version: [ oldstable, stable ] steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} stable: true - - name: Check out code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Check generated code run: | rm -f interp/op.go @@ -76,21 +76,21 @@ jobs: working-directory: ${{ github.workspace }}/go/src/github.com/traefik/yaegi strategy: matrix: - go-version: [ '1.21', '1.22' ] + go-version: [ oldstable, stable ] steps: - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - stable: true - - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: go/src/github.com/traefik/yaegi fetch-depth: 0 + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + stable: true + # https://github.com/marketplace/actions/cache - name: Cache Go modules uses: actions/cache@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 196d08bca..445269cde 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - v[0-9]+.[0-9]+* env: - GO_VERSION: '1.21' + GO_VERSION: stable jobs: @@ -15,28 +15,20 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Cache Go modules - uses: actions/cache@v3 + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v5 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: ${{ env.GO_VERSION }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }} diff --git a/.golangci.yml b/.golangci.yml index f01213a80..bfd412127 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -142,9 +142,10 @@ linters: issues: exclude-use-default: false - max-per-linter: 0 + max-issues-per-linter: 0 max-same-issues: 0 - exclude: [] + exclude: + - 'fmt.Sprintf can be replaced with string' exclude-rules: - path: .+_test\.go linters: diff --git a/.goreleaser.yml b/.goreleaser.yml index ca41187d6..0138f7322 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -47,7 +47,7 @@ archives: - LICENSE brews: - - tap: + - repository: owner: traefik name: homebrew-tap commit_author: diff --git a/cmd/yaegi/extract.go b/cmd/yaegi/extract.go index 8ca4f834a..64f579f82 100644 --- a/cmd/yaegi/extract.go +++ b/cmd/yaegi/extract.go @@ -3,6 +3,7 @@ package main import ( "bufio" "bytes" + "errors" "flag" "fmt" "io" @@ -38,7 +39,7 @@ func extractCmd(arg []string) error { args := eflag.Args() if len(args) == 0 { - return fmt.Errorf("missing package") + return errors.New("missing package") } license, err := genLicense(licensePath) diff --git a/extract/extract.go b/extract/extract.go index d727207f9..e2198b6df 100644 --- a/extract/extract.go +++ b/extract/extract.go @@ -387,7 +387,7 @@ func (e *Extractor) importPath(pkgIdent, importPath string) (string, error) { return "", err } if err != nil { - if len(pkgIdent) > 0 && pkgIdent[0] == '.' { + if pkgIdent != "" && pkgIdent[0] == '.' { // pkgIdent is definitely a relative path, not a package name, and it does not exist return "", err }