Skip to content

Commit

Permalink
lint(all): Fix golangci-lint issues
Browse files Browse the repository at this point in the history
Before using golangci-lint-action, lint failures were ignored
as the check was:

    make lint-golang || true

This fixes the issues found by the linter minus revive's
"unused parameter" check which is not something we agree with.
This matches what we've done in pulumi/pulumi.
  • Loading branch information
abhinav committed Aug 1, 2023
1 parent f12de8a commit 367607b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ linters:
- lll
- staticcheck # Disabled due to OOM errors in golangci-lint@v1.18.0
- megacheck # Disabled due to OOM errors in golangci-lint@v1.18.0

issues:
exclude-rules:
# Don't warn on unused parameters.
# Parameter names are useful; replacing them with '_' is undesirable.
- linters: [revive]
text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _'
3 changes: 1 addition & 2 deletions pkg/pulumiyaml/analyser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,9 +1099,8 @@ func (tc *typeCache) typeConfig(r *Runner, node configNode) bool {
ctx.errorf(node.key(), `config key "%s" cannot have conflicting types %v, %v`,
k, codegen.UnwrapType(typExisting), codegen.UnwrapType(typCurrent))
return false
} else {
typCurrent = typExisting
}
typCurrent = typExisting
}
tc.configuration[k] = typCurrent
return true
Expand Down
2 changes: 2 additions & 0 deletions pkg/tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func TestTypeCheckError(t *testing.T) {
})
}

//nolint:paralleltest // uses parallel programtest
func TestMismatchedConfigType(t *testing.T) {
testWrapper(t, integrationDir("mismatched-config-type"), ExpectFailure, StderrValidator{
f: func(t *testing.T, stderr string) {
Expand All @@ -38,6 +39,7 @@ func TestMismatchedConfigType(t *testing.T) {
})
}

//nolint:paralleltest // uses parallel programtest
func TestProjectConfigRef(t *testing.T) {
testWrapper(t, integrationDir("project-config-ref"), ExpectFailure, StderrValidator{
f: func(t *testing.T, stderr string) {
Expand Down

0 comments on commit 367607b

Please sign in to comment.