From 35708fa759d6f4b7f64f5a3d004253d083ff303e Mon Sep 17 00:00:00 2001 From: jmontesi Date: Wed, 25 Oct 2023 13:02:52 +0200 Subject: [PATCH 1/3] linters: use golangci-lint GitHub action instead of a manual setup --- .github/workflows/pre-main.yaml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pre-main.yaml b/.github/workflows/pre-main.yaml index dc8106363..2ddf31378 100644 --- a/.github/workflows/pre-main.yaml +++ b/.github/workflows/pre-main.yaml @@ -56,11 +56,6 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - # TODO: golangci-lint team recommends using a GitHub Action to perform golangci-lint responsibilities. However - # there does not appear to be a way to honor our existing .golangci.yml. For now, mimic developer behavior. - - name: Install golangci-lint - run: make install-lint - - name: Install checkmake run: | curl --location --output $CM_BIN --silent $CM_URL_LINUX @@ -69,6 +64,12 @@ jobs: - name: Install Shfmt uses: mfinelli/setup-shfmt@v3 + - name: Golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 + args: --timeout 10m0s + - name: Checkmake run: checkmake --config=.checkmake Makefile @@ -81,7 +82,7 @@ jobs: - name: Shfmt run: shfmt -d *.sh script - - name: markdownlint + - name: Markdownlint uses: nosborn/github-action-markdown-cli@v3.3.0 with: files: . @@ -97,10 +98,7 @@ jobs: with: config_file: .yamllint.yml - - name: Golangci-lint - run: golangci-lint run --timeout 10m0s - - - name: make vet + - name: Go vet run: make vet unit-tests: name: Run Unit Tests From cb569c11951a66db804a469c64900acf6bac534b Mon Sep 17 00:00:00 2001 From: jmontesi Date: Wed, 25 Oct 2023 14:41:40 +0200 Subject: [PATCH 2/3] Test commit to verify golangci-lint --- cnf-certification-test/platform/suite.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cnf-certification-test/platform/suite.go b/cnf-certification-test/platform/suite.go index 2b4935f63..d00a011f0 100644 --- a/cnf-certification-test/platform/suite.go +++ b/cnf-certification-test/platform/suite.go @@ -181,7 +181,6 @@ func testHyperThreadingEnabled(env *provider.TestEnvironment) { for _, node := range baremetalNodes { nodeName := node.Data.Name enable, err := node.IsHyperThreadNode(env) - //nolint:gocritic if enable { compliantObjects = append(compliantObjects, testhelper.NewNodeReportObject(nodeName, "Node has hyperthreading enabled", true)) } else if err != nil { @@ -254,7 +253,6 @@ func testContainersFsDiff(env *provider.TestEnvironment) { testhelper.AddTestResultReason(compliantObjects, nonCompliantObjects, tnf.ClaimFilePrintf, ginkgo.Fail) } -//nolint:funlen func testTainted(env *provider.TestEnvironment) { var compliantObjects []*testhelper.ReportObject var nonCompliantObjects []*testhelper.ReportObject From 4037e5992f64958e2b0b31dd7c026e4038b0f493 Mon Sep 17 00:00:00 2001 From: jmontesi Date: Wed, 25 Oct 2023 16:35:33 +0200 Subject: [PATCH 3/3] Revert "Test commit to verify golangci-lint" This reverts commit cb569c11951a66db804a469c64900acf6bac534b. --- cnf-certification-test/platform/suite.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cnf-certification-test/platform/suite.go b/cnf-certification-test/platform/suite.go index d00a011f0..2b4935f63 100644 --- a/cnf-certification-test/platform/suite.go +++ b/cnf-certification-test/platform/suite.go @@ -181,6 +181,7 @@ func testHyperThreadingEnabled(env *provider.TestEnvironment) { for _, node := range baremetalNodes { nodeName := node.Data.Name enable, err := node.IsHyperThreadNode(env) + //nolint:gocritic if enable { compliantObjects = append(compliantObjects, testhelper.NewNodeReportObject(nodeName, "Node has hyperthreading enabled", true)) } else if err != nil { @@ -253,6 +254,7 @@ func testContainersFsDiff(env *provider.TestEnvironment) { testhelper.AddTestResultReason(compliantObjects, nonCompliantObjects, tnf.ClaimFilePrintf, ginkgo.Fail) } +//nolint:funlen func testTainted(env *provider.TestEnvironment) { var compliantObjects []*testhelper.ReportObject var nonCompliantObjects []*testhelper.ReportObject