Compare commits

..

8 Commits

Author SHA1 Message Date
Denis Bilenko 4639a73343 merge comments from old lint:ignore directives into //nolint 2024-12-04 16:20:56 +01:00
Denis Bilenko 82ac762aa8 use explicit go-version instead of stable 2024-12-04 15:18:35 +01:00
Denis Bilenko db551ac192 Revert "temporary - try to remove setup-go"
This reverts commit 0027c654f1.
2024-12-04 15:17:58 +01:00
Denis Bilenko d4d0a36087 use //nolint: comment instead of central config
This more precise, only affects a given line and not all matching lines.
2024-12-04 14:55:27 +01:00
Denis Bilenko 0027c654f1 temporary - try to remove setup-go 2024-12-04 14:41:37 +01:00
Denis Bilenko e852499473 add 'make lintfix' command 2024-12-04 14:40:36 +01:00
Denis Bilenko 5479cf2eda update vscode settings as described https://golangci-lint.run/welcome/integrations/
tested in vscode
2024-12-04 11:35:28 +01:00
Denis Bilenko a3c6b5ed76 Clean up comments 2024-12-04 11:22:51 +01:00
6 changed files with 11 additions and 12 deletions

View File

@ -96,7 +96,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
go-version: 1.23.2
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:

View File

@ -1,9 +1,5 @@
linters:
# Disable all linters.
# Default: false
disable-all: true
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
# errcheck and govet are part of default setup and should be included but give too many errors now
# once errors are fixed, they should be enabled here:
@ -17,12 +13,7 @@ linters:
linters-settings:
gofmt:
rewrite-rules:
#- pattern: 'interface{}'
# replacement: 'any'
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
issues:
exclude-dirs-use-default: false # recommended by docs https://golangci-lint.run/usage/false-positives/
exclude:
- "SA1019: tfexec.State is deprecated: The -state CLI flag is a legacy flag and should not be used. If you need a different state file for every run, you can instead use the local backend. See https://github.com/hashicorp/terraform/issues/25920#issuecomment-676560799"
- "SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use"

View File

@ -3,6 +3,10 @@
"editor.insertSpaces": false,
"editor.formatOnSave": true
},
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast"
],
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,

View File

@ -10,6 +10,10 @@ lint: vendor
@echo "✓ Linting source code with https://golangci-lint.run/ ..."
@golangci-lint run ./...
lintfix: vendor
@echo "✓ Linting source code with 'golangci-lint run --fix' ..."
@golangci-lint run --fix ./...
test: lint testonly
testonly:

View File

@ -56,7 +56,7 @@ func (m *importResource) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
buf := bytes.NewBuffer(nil)
tf.SetStdout(buf)
//lint:ignore SA1019 We use legacy -state flag for now to plan the import changes based on temporary state file
//nolint:staticcheck // SA1019 We use legacy -state flag for now to plan the import changes based on temporary state file
changed, err := tf.Plan(ctx, tfexec.State(tmpState), tfexec.Target(importAddress))
if err != nil {
return diag.Errorf("terraform plan: %v", err)

View File

@ -250,7 +250,7 @@ func (t *cobraTestRunner) RunBackground() {
// Reset context on command for the next test.
// These commands are globals so we have to clean up to the best of our ability after each run.
// See https://github.com/spf13/cobra/blob/a6f198b635c4b18fff81930c40d464904e55b161/command.go#L1062-L1066
//lint:ignore SA1012 cobra sets the context and doesn't clear it
//nolint:staticcheck // cobra sets the context and doesn't clear it
cli.SetContext(nil)
// Make caller aware of error.