From efc33d50057450f6ba7cd210b07d6f6f12fa9aa5 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Wed, 17 Jul 2024 14:40:45 +0000 Subject: [PATCH] Fixing linter issues --- .github/workflows/lint.yaml | 16 +++++----------- .github/workflows/test.yaml | 20 ++++---------------- .golangci.toml | 15 --------------- .golangci.yaml | 30 ++++++++++++++++++++++++++++++ tax_id.go | 10 ---------- test/test.go | 2 +- 6 files changed, 40 insertions(+), 53 deletions(-) delete mode 100644 .golangci.toml create mode 100644 .golangci.yaml delete mode 100644 tax_id.go diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a244333..14aa2ae 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -15,19 +15,13 @@ jobs: - name: Check out code uses: actions/checkout@v3 - - name: Prepare .netrc - uses: extractions/netrc@v1 - with: - machine: github.com - username: ${{ secrets.GO_MOD_USER }} - password: ${{ secrets.GO_MOD_PASS }} - - name: Set up Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v4 with: - go-version: "1.20.4" + go-version-file: "go.mod" + id: go - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v2 with: - version: v1.55 + version: v1.58 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 47c63c4..144552a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,30 +6,18 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go - uses: actions/setup-go@v1 - with: - go-version: "1.21.5" - id: go - - name: Check out code uses: actions/checkout@v3 - #- name: Configure git for private modules - # run: | - # git config --global url."https://${{ secrets.GO_MOD_USER }}:${{ secrets.GO_MOD_PASS }}@github.com".insteadOf "https://github.com" - - - name: Prepare .netrc - uses: extractions/netrc@v1 + - name: Set up Go + uses: actions/setup-go@v4 with: - machine: github.com - username: ${{ secrets.GO_MOD_USER }} - password: ${{ secrets.GO_MOD_PASS }} + go-version-file: "go.mod" + id: go - name: Install Dependencies env: GOPROXY: https://proxy.golang.org,direct - GOPRIVATE: github.com/invopop run: go mod download - name: Test diff --git a/.golangci.toml b/.golangci.toml deleted file mode 100644 index 1178f29..0000000 --- a/.golangci.toml +++ /dev/null @@ -1,15 +0,0 @@ -[run] -timeout = "120s" - -[output] -format = "colored-line-number" - -[linters] -enable = [ - "gocyclo", "unconvert", "goimports", "unused", - "vetshadow", "misspell", "nakedret", "errcheck", "revive", "ineffassign", - "goconst", "vet", "unparam", "gofmt" -] - -[issues] -exclude-use-default = false diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..1925251 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,30 @@ +run: + timeout: "120s" + +output: + formats: + - format: "colored-line-number" + +linters: + enable: + - "gocyclo" + - "unconvert" + - "goimports" + - "govet" + #- "misspell" # doesn't handle multilanguage well + - "nakedret" + - "revive" + - "goconst" + - "unparam" + - "gofmt" + - "errname" + - "zerologlint" + +linters-settings: + staticcheck: + # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks + # Default: ["*"] + checks: ["all"] + +issues: + exclude-use-default: false diff --git a/tax_id.go b/tax_id.go deleted file mode 100644 index c960f06..0000000 --- a/tax_id.go +++ /dev/null @@ -1,10 +0,0 @@ -package fatturapa - -// taxID is the VAT identification number consisting of a country code and the -// actual VAT number. -type taxID struct { - // ISO 3166-1 alpha-2 country code - IdPaese string // nolint:revive - // Actual VAT number - IdCodice string // nolint:revive -} diff --git a/test/test.go b/test/test.go index 06189fa..437102b 100644 --- a/test/test.go +++ b/test/test.go @@ -65,7 +65,7 @@ func ConvertFromGOBL(env *gobl.Envelope, converter ...*fatturapa.Converter) (*fa // into XML fatturapa documents. func TestConversion() error { // nolint:revive var files []string - err := filepath.Walk(GetDataPath(), func(path string, info os.FileInfo, err error) error { + err := filepath.Walk(GetDataPath(), func(path string, _ os.FileInfo, _ error) error { if filepath.Ext(path) == ".json" { files = append(files, filepath.Base(path)) }