From 242af051cea566edd01e3efcb3066610e18afa92 Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Wed, 25 Sep 2024 02:39:13 +0000 Subject: [PATCH] Bump up golang in github actions And fix resuting linter errors Signed-off-by: Anna Khmelnitsky --- .github/workflows/golangci-lint.yml | 6 +++--- .github/workflows/golangci-ut.yml | 4 ++-- .github/workflows/release.yml | 6 ++++-- .golangci.yml | 1 - nsxt/data_source_nsxt_policy_uplink_host_switch_profile.go | 1 + nsxt/data_source_nsxt_upgrade_prepare_ready.go | 1 + nsxt/resource_nsxt_upgrade_run.go | 5 +++++ 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a6b24f27f..8f01f825e 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -5,10 +5,10 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: 1.22 - - uses: actions/checkout@v3 + go-version-file: 'go.mod' - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/golangci-ut.yml b/.github/workflows/golangci-ut.yml index 54454959e..89c61c47c 100644 --- a/.github/workflows/golangci-ut.yml +++ b/.github/workflows/golangci-ut.yml @@ -5,10 +5,10 @@ jobs: test: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: 1.22 - - uses: actions/checkout@v4 + go-version-file: 'go.mod' - name: Install dependencies run: | go get . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3839523a..fd73ba78a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,20 +14,22 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version-file: 'go.mod' - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: version: v1.50 args: --issues-exit-code=1 + skip-pkg-cache: true + skip-build-cache: true - name: Import GPG key id: import_gpg diff --git a/.golangci.yml b/.golangci.yml index 029987e12..27f2b38e8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,7 +21,6 @@ linters: - gosec - goimports - vet - - revive - misspell - gosimple - staticcheck diff --git a/nsxt/data_source_nsxt_policy_uplink_host_switch_profile.go b/nsxt/data_source_nsxt_policy_uplink_host_switch_profile.go index 6447ffd67..79f711398 100644 --- a/nsxt/data_source_nsxt_policy_uplink_host_switch_profile.go +++ b/nsxt/data_source_nsxt_policy_uplink_host_switch_profile.go @@ -5,6 +5,7 @@ package nsxt import ( "fmt" + "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/nsxt/data_source_nsxt_upgrade_prepare_ready.go b/nsxt/data_source_nsxt_upgrade_prepare_ready.go index fafa67737..c72484f8d 100644 --- a/nsxt/data_source_nsxt_upgrade_prepare_ready.go +++ b/nsxt/data_source_nsxt_upgrade_prepare_ready.go @@ -5,6 +5,7 @@ package nsxt import ( "fmt" + "github.com/vmware/terraform-provider-nsxt/nsxt/util" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/nsxt/resource_nsxt_upgrade_run.go b/nsxt/resource_nsxt_upgrade_run.go index 622dea941..64f4e22a3 100644 --- a/nsxt/resource_nsxt_upgrade_run.go +++ b/nsxt/resource_nsxt_upgrade_run.go @@ -393,6 +393,7 @@ func prepareUpgrade(upgradeClientSet *upgradeClientSet, d *schema.ResourceData, continue } + //#nosec G601 Ignore implicit memory aliasing in for loop temporarily status, err := getUpgradeStatus(upgradeClientSet.StatusClient, &component) if err != nil { return err @@ -407,6 +408,7 @@ func prepareUpgrade(upgradeClientSet *upgradeClientSet, d *schema.ResourceData, if status.Status == model.ComponentUpgradeStatus_STATUS_IN_PROGRESS { upgradeClientSet.PlanClient.Pause() } + //#nosec G601 Ignore implicit memory aliasing in for loop temporarily err = waitUpgradeForStatus(upgradeClientSet, &component, inFlightComponentUpgradeStatus, staticComponentUpgradeStatus) if err != nil { return err @@ -414,6 +416,7 @@ func prepareUpgrade(upgradeClientSet *upgradeClientSet, d *schema.ResourceData, // Cache the group list before reset as group IDs change by reset operation. References for some types of groups // could be affected here + //#nosec G601 Ignore implicit memory aliasing in for loop temporarily preResetGroupList, err := upgradeClientSet.GroupClient.List(&component, nil, nil, nil, nil, nil, nil, nil) if err != nil { return err @@ -746,7 +749,9 @@ func runUpgrade(upgradeClientSet *upgradeClientSet, partialUpgradeMap map[string prevComponent = component completeLog = fmt.Sprintf("[INFO] %s upgrade is partially completed.", component) } + //#nosec G601 Ignore implicit memory aliasing in for loop temporarily upgradeClientSet.PlanClient.Upgrade(&component) + //#nosec G601 Ignore implicit memory aliasing in for loop temporarily err = waitUpgradeForStatus(upgradeClientSet, &component, pendingStatus, targetStatus) if err != nil { return err