From bfa98a208749d0798cf95d4b33ae3bf432e4cecf Mon Sep 17 00:00:00 2001 From: Andrews Arokiam Date: Wed, 13 Dec 2023 12:31:03 +0530 Subject: [PATCH] go lint check. Signed-off-by: Andrews Arokiam --- .github/workflows/golangci-lint.yml | 39 +++++++++++++++++++++++++++++ .golangci.yaml | 23 +++++++++++++++++ cmd/agent/main.go | 4 +-- 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yaml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 00000000000..50c7dd827ba --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,39 @@ +name: GO Lint Check + +on: + push: + branches: [master, release*] + pull_request: + branches: [] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.21.x + + - name: Check out code + uses: actions/checkout@v2 + + - id: golangci_configuration + uses: andstor/file-existence-action@v1 + with: + files: .golangci.yaml # file must be required for linter configuration + + - name: Go Lint + if: steps.golangci_configuration.outputs.files_exists == 'true' + uses: golangci/golangci-lint-action@v3 + with: + # only-new-issues: true + version: v1.55.2 + args: --go=1.21 diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 00000000000..85cc76582b1 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,23 @@ +run: + timeout: 5m + +linters: + disable-all: true + enable: + - asciicheck + - errorlint + - gosec + - importas + - prealloc + - unconvert + - stylecheck + - unparam + - errcheck + +output: + format: colored-line-number + print-issued-lines: true + print-linter-name: true + uniq-by-line: false + path-prefix: "" + sort-results: true diff --git a/cmd/agent/main.go b/cmd/agent/main.go index 7457ebe2808..825f5d3f071 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -74,12 +74,12 @@ var ( const ( // reportingPeriod is the interval of time between reporting stats by queue proxy. - reportingPeriod = 1 * time.Second + reportingPeriod = 1 * time.Second // Duration the /wait-for-drain handler should wait before returning. // This is to give networking a little bit more time to remove the pod // from its configuration and propagate that to all loadbalancers and nodes. - drainSleepDuration = 30 * time.Second + drainSleepDuration = 30 * time.Second ) type config struct {