diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000000..5f35fac3f0b --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,19 @@ +on: [push, pull_request] +name: linter + +jobs: + lint: + strategy: + matrix: + go-version: [1.x] + platform: [ubuntu-latest] + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v2 + + - name: golangci-lint + uses: golangci/golangci-lint-action@5c56cd6c9dc07901af25baab6f2b0d9f3b7c3018 #v2.5.2 + with: + version: v1.41 + args: --verbose diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000000..afd9675f2f8 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,32 @@ +linters: + # TODO: fix errors so that all of the linters below pass. + # The linters that are commented out, as well as those explicitly disabled, + # are currently failing. We should fix those failures or define exclusion + # rules, and then enable those linters. + enable: + - dogsled + - dupl + - gofmt + - goimports + # - gosec + - misspell + - nakedret + # - stylecheck + # - unconvert + # - unparam + # - whitespace + disable: + - errcheck + - gosimple + - staticcheck + - ineffassign + - unused +issues: + exclude-rules: + - linters: + - dogsled + text: "declaration has 3 blank identifiers" + path: _test\.go + - linters: + - dupl + path: _test\.go diff --git a/github/activity_notifications.go b/github/activity_notifications.go index 9b6fbe2b58e..009cc5e32a8 100644 --- a/github/activity_notifications.go +++ b/github/activity_notifications.go @@ -51,7 +51,7 @@ type NotificationListOptions struct { // // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-notifications-for-the-authenticated-user func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) { - u := fmt.Sprintf("notifications") + u := "notifications" u, err := addOptions(u, opts) if err != nil { return nil, nil, err