Skip to content

Commit 7b92b55

Browse files
committed
Revert some workflow changes
Signed-off-by: Kobi Samoray <kobi.samoray@broadcom.com>
1 parent 422a9ef commit 7b92b55

File tree

4 files changed

+69
-112
lines changed

4 files changed

+69
-112
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
---
21
name: golangci-lint
32

43
on:
54
pull_request:
65
paths-ignore:
7-
- README.md
6+
- 'README.md'
87
push:
98
paths-ignore:
10-
- README.md
9+
- 'README.md'
1110

1211
permissions:
1312
contents: read
@@ -16,19 +15,20 @@ jobs:
1615
build:
1716
name: Build
1817
runs-on: ubuntu-latest
18+
timeout-minutes: 5
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
2222
- name: Setup Go
2323
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
2424
with:
25-
go-version-file: go.mod
25+
go-version-file: 'go.mod'
2626
cache: false
2727
- run: go mod download
2828
- run: go build -v .
2929
- name: Run Linters
30-
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
30+
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
3131
with:
32-
version: latest
32+
version: v1.64.8
3333
args: --issues-exit-code=1 --timeout 10m
3434
only-new-issues: true

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: golangci-lint
2424
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
2525
with:
26-
version: v1.61
26+
version: v1.64.8
2727
args: --issues-exit-code=1 --timeout=30m
2828
skip-pkg-cache: true
2929
skip-build-cache: true

.golangci.yml

Lines changed: 40 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,52 @@
1-
---
2-
version: "2"
1+
# © Broadcom. All Rights Reserved.
2+
# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
3+
# SPDX-License-Identifier: MPL-2.0
34

4-
output:
5-
formats:
6-
text:
7-
path: stdout
5+
# For more information about the golangci-lint configuration file, refer to:
6+
# https://golangci-lint.run/usage/configuration/
7+
8+
issues:
9+
exclude-rules:
10+
# Exclude specific staticcheck rules to suppress false positives or acceptable issues.
11+
- linters: [staticcheck]
12+
text: "SA4004|SA1019|GetOkExists"
13+
# Exclude specific gosec rules to suppress warnings about issues deemed acceptable.
14+
- linters: [gosec]
15+
text: "G402|G404|G115"
816

917
linters:
10-
default: none
18+
disable-all: true # Disable all linters by default and enable only the ones required.
1119
enable:
12-
- gosec # Checks for security issues in code.
20+
- gofmt # Checks Go code formatting.
21+
- goimports # Ensures proper import formatting.
22+
- gosimple # Reports simplifications in code.
1323
- govet # Examines code for possible mistakes.
24+
- gosec # Checks for security issues in code.
1425
- ineffassign # Detects inefficient assignments.
1526
- misspell # Finds and fixes typos.
1627
- staticcheck # Reports bugs, code smells, and deprecated practices.
17-
- unused # Detects unused variables, constants, etc.
18-
settings:
19-
errcheck:
20-
exclude-functions:
21-
- github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set
22-
- fmt:.*
23-
- io:Close
24-
revive:
25-
rules:
26-
- name: unreachable-code # Detect code that will never be executed.
27-
- name: errorf # Avoid string formatting in error messages.
28-
- name: range # Improve range loop usage.
29-
- name: superfluous-else # Eliminate unnecessary else statements.
30-
- name: var-declaration # Simplify variable declaration.
31-
- name: duplicated-imports # Detect and remove duplicate imports.-imports
32-
exclusions:
33-
generated: lax
34-
presets:
35-
- comments
36-
- common-false-positives
37-
- legacy
38-
- std-error-handling
39-
rules:
40-
# Exclude specific staticcheck rules to suppress false positives or acceptable issues.
41-
- linters:
42-
- staticcheck
43-
text: SA4004|SA1019|GetOkExists
44-
# Exclude specific gosec rules to suppress warnings about issues deemed acceptable.
45-
- linters:
46-
- gosec
47-
text: G402|G404|G115
48-
# TODO: Setting temporary exclusions.
49-
- linters:
50-
- staticcheck
51-
text: QF1001
52-
- linters:
53-
- staticcheck
54-
text: QF1003
55-
- linters:
56-
- staticcheck
57-
text: QF1004
58-
- linters:
59-
- staticcheck
60-
text: QF1007
61-
- linters:
62-
- staticcheck
63-
text: QF1011
64-
- linters:
65-
- staticcheck
66-
text: ST1005
67-
paths:
68-
- third_party$
69-
- builtin$
70-
- examples$
7128

7229
run:
7330
timeout: 30m # Sets the maximum time limit for the linter run.
7431

75-
formatters:
76-
enable:
77-
- gofmt
78-
- goimports
79-
exclusions:
80-
generated: lax
81-
paths:
82-
- third_party$
83-
- builtin$
84-
- examples$
32+
output:
33+
formats:
34+
- format: colored-line-number # Allows colored output with line numbers when errors are reported.
35+
36+
linters-settings:
37+
errcheck:
38+
# Exclude specific functions from errcheck warnings, as errors are intentionally ignored in these cases.
39+
exclude-functions:
40+
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set"
41+
- "fmt:.*"
42+
- "io:Close"
43+
44+
revive:
45+
# Enable specific rules for the revive linter for improved code quality and readability.
46+
rules:
47+
- name: unreachable-code # Detect code that will never be executed.
48+
- name: errorf # Avoid string formatting in error messages.
49+
- name: range # Improve range loop usage.
50+
- name: superfluous-else # Eliminate unnecessary else statements.
51+
- name: var-declaration # Simplify variable declaration.
52+
- name: duplicated-imports # Detect and remove duplicate imports.-imports

.goreleaser.yml

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
---
2-
version: 2
3-
4-
project_name: terraform-provider-nsxt
5-
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
63
before:
74
hooks:
5+
# this is just an example and not a requirement for provider building/publishing
86
- go mod tidy
9-
107
builds:
11-
- id: default
12-
binary: '{{ .ProjectName }}_v{{ .Version }}'
8+
- env:
9+
# goreleaser does not work with CGO, it could also complicate
10+
# usage by users in CI/CD systems like Terraform Cloud where
11+
# they are unable to install libraries.
12+
- CGO_ENABLED=0
13+
mod_timestamp: '{{ .CommitTimestamp }}'
14+
flags:
15+
- -trimpath
16+
ldflags:
17+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
1318
goos:
14-
- linux
19+
- freebsd
1520
- windows
21+
- linux
1622
- darwin
17-
- freebsd
1823
goarch:
1924
- amd64
2025
- '386'
@@ -23,44 +28,28 @@ builds:
2328
ignore:
2429
- goos: darwin
2530
goarch: '386'
26-
env:
27-
- CGO_ENABLED=0
28-
flags:
29-
- -trimpath
30-
ldflags:
31-
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
32-
mod_timestamp: '{{ .CommitTimestamp }}'
33-
31+
binary: '{{ .ProjectName }}_v{{ .Version }}'
3432
archives:
35-
- id: default
33+
- format: zip
3634
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
37-
formats: ['zip']
38-
3935
checksum:
4036
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
4137
algorithm: sha256
42-
extra_files:
43-
- glob: 'terraform-registry-manifest.json'
44-
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
45-
4638
signs:
47-
- id: default
48-
artifacts: checksum
39+
- artifacts: checksum
4940
args:
41+
# if you are using this is a GitHub action or some other automated pipeline, you
42+
# need to pass the batch flag to indicate its not interactive.
5043
- "--batch"
5144
- "--local-user"
52-
- "{{ .Env.GPG_FINGERPRINT }}"
45+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
5346
- "--output"
5447
- "${signature}"
5548
- "--detach-sign"
5649
- "${artifact}"
57-
5850
release:
51+
# Visit your project's GitHub Releases page to publish this release.
5952
draft: true
60-
extra_files:
61-
- glob: 'terraform-registry-manifest.json'
62-
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
63-
6453
changelog:
6554
filters:
6655
exclude:

0 commit comments

Comments
 (0)