diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 00000000..ab269278 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,25 @@ +name: golangci-lint +on: + push: + branches: + - main + - master + pull_request: + +permissions: + contents: read + pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: golangci-lint + uses: golangci/golangci-lint-action@v7 + with: + version: v2.0 diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml deleted file mode 100644 index 3a65f0bc..00000000 --- a/.github/workflows/reviewdog.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: reviewdog -on: [pull_request] -jobs: - golangci-lint: - name: runner / golangci-lint - runs-on: ubuntu-latest - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - name: golangci-lint - uses: reviewdog/action-golangci-lint@v2 - - - name: Setup reviewdog - uses: reviewdog/action-setup@v1 - - - name: gofumpt -s with reviewdog - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - go install mvdan.cc/gofumpt@v0.2.0 - gofumpt -e -d . | \ - reviewdog -name="gofumpt" -f=diff -f.diff.strip=0 -reporter=github-pr-review \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml index b88bf672..6c48152c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,9 @@ +version: "2" + linters: + default: standard enable: - cyclop - - exportloopref - gocritic - gosec - ineffassign @@ -9,12 +11,9 @@ linters: - prealloc - unconvert - unparam - - goimports - whitespace -linters-settings: - whitespace: - multi-func: true - goimports: - local-prefixes: gorm.io/gorm - +formatters: + enable: + - gofumpt + - goimports diff --git a/schema/index.go b/schema/index.go index 72fc6ca8..a1cdc639 100644 --- a/schema/index.go +++ b/schema/index.go @@ -122,7 +122,7 @@ func parseFieldIndexes(field *Field) (indexes []Index, err error) { if composite, found := settings[key]; found { if len(composite) == 0 || composite == key { err = fmt.Errorf( - "The composite tag of %s.%s cannot be empty", + "the composite tag of %s.%s cannot be empty", field.Schema.Name, field.Name) return