Skip to content

Commit 55b4ffd

Browse files
author
Anna Khmelnitsky
committed
Bump up github action versions and linter
And adjust code to new linter settings Signed-off-by: Anna Khmelnitsky <[email protected]>
1 parent ede0dfe commit 55b4ffd

12 files changed

+35
-22
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jobs:
55
test:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/setup-go@v3
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-go@v5
910
with:
10-
go-version: 1.22
11-
- uses: actions/checkout@v3
11+
go-version-file: 'go.mod'
1212
- name: golangci-lint
1313
uses: golangci/golangci-lint-action@v3
1414
with:

.github/workflows/golangci-ut.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jobs:
55
test:
66
runs-on: ubuntu-latest
77
steps:
8+
- uses: actions/checkout@v4
89
- uses: actions/setup-go@v5
910
with:
10-
go-version: 1.22
11-
- uses: actions/checkout@v4
11+
go-version-file: 'go.mod'
1212
- name: Install dependencies
1313
run: |
1414
go get .

.github/workflows/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,29 @@ jobs:
1414
steps:
1515
-
1616
name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
with:
1919
fetch-depth: 0
2020
-
2121
name: Set up Go
22-
uses: actions/setup-go@v3
22+
uses: actions/setup-go@v5
2323
with:
24-
go-version: 1.19
24+
go-version-file: 'go.mod'
2525
-
2626
name: golangci-lint
2727
uses: golangci/golangci-lint-action@v3
2828
with:
29-
version: v1.50
30-
args: --issues-exit-code=1
29+
version: v1.61
30+
args: --issues-exit-code=1 --timeout=30m
31+
skip-pkg-cache: true
32+
skip-build-cache: true
3133
-
3234
name: Import GPG key
3335
id: import_gpg
3436
uses: crazy-max/ghaction-import-gpg@v6
3537
with:
36-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
37-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
38+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY2 }}
39+
passphrase: ${{ secrets.GPG_PASSPHRASE2 }}
3840
-
3941
name: Run GoReleaser
4042
uses: goreleaser/goreleaser-action@v5

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ issues:
66
- SA1019
77
- G402
88
- G404
9+
- G115
910
- GetOkExists
1011

1112
run:
12-
deadline: 5m
13+
deadline: 30m
1314

1415
linters:
1516
disable-all: true
@@ -20,8 +21,7 @@ linters:
2021
- staticcheck
2122
- gosec
2223
- goimports
23-
- vet
24-
- revive
24+
- govet
2525
- misspell
2626
- gosimple
2727
- staticcheck

nsxt/data_source_nsxt_policy_host_transport_node_collection_realization.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package nsxt
55

66
import (
7+
"errors"
78
"fmt"
89
"log"
910
"time"
@@ -122,5 +123,5 @@ func getErrorFromState(state *model.TransportNodeCollectionState) error {
122123
result += fmt.Sprintf("VCLM transition error: %v\n", *state.VlcmTransitionError)
123124
}
124125

125-
return fmt.Errorf(result)
126+
return errors.New(result)
126127
}

nsxt/data_source_nsxt_policy_uplink_host_switch_profile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package nsxt
55

66
import (
77
"fmt"
8+
89
"github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
910

1011
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

nsxt/data_source_nsxt_upgrade_prepare_ready.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
package nsxt
55

66
import (
7+
"errors"
78
"fmt"
9+
810
"github.com/vmware/terraform-provider-nsxt/nsxt/util"
911

1012
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -84,7 +86,7 @@ func dataSourceNsxtUpgradePrepareReadyRead(d *schema.ResourceData, m interface{}
8486
errMessage += fmt.Sprintf("\nThere are unacknowledged warnings in prechecks:\n%s\nPlease address these errors from NSX or using nsxt_upgrade_precheck_acknowledge resource", preCheckText)
8587
}
8688
if len(errMessage) > 0 {
87-
return fmt.Errorf(errMessage)
89+
return errors.New(errMessage)
8890
}
8991
objID := util.GetVerifiableID(newUUID(), "nsxt_upgrade_prepare_ready")
9092
d.SetId(objID)

nsxt/policy_errors.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package nsxt
55

66
import (
7+
liberrors "errors"
78
"fmt"
89
"log"
910

@@ -104,7 +105,7 @@ func logVapiErrorData(message string, vapiMessages []std.LocalizableMessage, vap
104105
}
105106
}
106107
log.Printf("[ERROR]: %s", details)
107-
return fmt.Errorf(details)
108+
return liberrors.New(details)
108109
}
109110

110111
func logAPIError(message string, err error) error {

nsxt/resource_nsxt_lb_pool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func setSnatTranslationInSchema(d *schema.ResourceData, snatTranslation *loadbal
251251
if snatTranslation != nil {
252252
if snatTranslation.Type_ == "LbSnatIpPool" {
253253
elem["type"] = "SNAT_IP_POOL"
254-
if snatTranslation.IpAddresses != nil && len(snatTranslation.IpAddresses) > 0 {
254+
if len(snatTranslation.IpAddresses) > 0 {
255255
elem["ip"] = snatTranslation.IpAddresses[0].IpAddress
256256
}
257257
} else {
@@ -421,7 +421,7 @@ func resourceNsxtLbPoolRead(d *schema.ResourceData, m interface{}) error {
421421
d.Set("description", lbPool.Description)
422422
d.Set("display_name", lbPool.DisplayName)
423423
setTagsInSchema(d, lbPool.Tags)
424-
if lbPool.ActiveMonitorIds != nil && len(lbPool.ActiveMonitorIds) > 0 {
424+
if len(lbPool.ActiveMonitorIds) > 0 {
425425
d.Set("active_monitor_id", lbPool.ActiveMonitorIds[0])
426426
} else {
427427
d.Set("active_monitor_id", "")

nsxt/resource_nsxt_policy_ipsec_vpn_session.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ func resourceNsxtPolicyIPSecVpnSessionRead(d *schema.ResourceData, m interface{}
638638
}
639639
var subnets []string
640640
var prefixLength int64
641-
if blockVPN.TunnelInterfaces != nil && len(blockVPN.TunnelInterfaces) > 0 {
641+
if len(blockVPN.TunnelInterfaces) > 0 {
642642
for _, tunnelInterface := range blockVPN.TunnelInterfaces {
643643
ipSubnets := tunnelInterface.IpSubnets
644644
for _, ipSubnet := range ipSubnets {

0 commit comments

Comments
 (0)