Skip to content

Commit 6f4c9ce

Browse files
committed
Fix golangci-lint issues and add pre-commit
1 parent 4758295 commit 6f4c9ce

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
uses: golangci/golangci-lint-action@v6
3434
with:
3535
version: latest
36+
args: --tests=false
3637

3738
generate:
3839
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/golangci/golangci-lint
5+
rev: v1.62.2
6+
hooks:
7+
- id: golangci-lint
8+
args:
9+
- "--tests=false"

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
terraform 1.9.8
2+
pre-commit 4.0.1

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tasks:
2121
lint:
2222
desc: Run the linter
2323
cmds:
24-
- golangci-lint run
24+
- golangci-lint run --tests=false
2525

2626
generate:
2727
desc: Generate documentation

internal/provider/project_template_resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ func convertTemplateResponseToProjectTemplateModel(ctx context.Context, request
486486
}
487487
}
488488

489-
if request.SurveyVars == nil || len(request.SurveyVars) == 0 {
489+
if len(request.SurveyVars) == 0 {
490490
model.SurveyVars = prev.SurveyVars
491491
} else {
492492
var surveyVars []projectTemplateSurveyVarModel
@@ -513,7 +513,7 @@ func convertTemplateResponseToProjectTemplateModel(ctx context.Context, request
513513
model.SurveyVars = surveyVarsModel
514514
}
515515

516-
if request.Vaults == nil || len(request.Vaults) == 0 {
516+
if len(request.Vaults) == 0 {
517517
model.Vaults = prev.Vaults
518518
} else {
519519
sort.Sort(ByVaultID(request.Vaults))

0 commit comments

Comments
 (0)