Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix golangci #500

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cron_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: setup go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.22.x

- name: checkout source
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
- name: setup go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.22.x

- name: checkout
uses: actions/checkout@v4

- name: lint go
uses: golangci/golangci-lint-action@v6
with:
version: v1.52
version: v1.59
args: --timeout=5m --color=always --max-same-issues=0 --max-issues-per-linter=0

acceptance:
Expand All @@ -31,7 +31,7 @@ jobs:
- name: setup go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.22.x

- name: checkout source
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push_container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: setup go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.22.x

- name: checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_cli_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: setup go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.22.x

- name: checkout source
uses: actions/checkout@v4
Expand Down
3 changes: 0 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ linter-settings:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- goconst
- gofmt
Expand All @@ -20,10 +19,8 @@ linters:
- predeclared
- revive
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- wastedassign
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/plexsystems/konstraint

go 1.21
go 1.22

require (
github.com/open-policy-agent/frameworks/constraint v0.0.0-20220218180203-c2a0d8cdf85a
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func newConvertCommand() *cobra.Command {

konstraint convert examples`,

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
path := "."
if len(args) > 0 {
path = args[0]
Expand Down
20 changes: 11 additions & 9 deletions internal/rego/rego.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,17 +657,19 @@ func (r Rego) SkipConstraint() bool {

func parseDirectory(directory string, parseImports bool) ([]Rego, error) {
// Recursively find all rego files (ignoring test files), starting at the given directory.
result, err := loader.NewFileLoader().WithProcessAnnotation(true).Filtered([]string{directory}, func(abspath string, info os.FileInfo, depth int) bool {
if strings.HasSuffix(info.Name(), "_test.rego") {
return true
}
result, err := loader.NewFileLoader().
WithProcessAnnotation(true).
Filtered([]string{directory}, func(_ string, info os.FileInfo, _ int) bool {
if strings.HasSuffix(info.Name(), "_test.rego") {
return true
}

if !info.IsDir() && filepath.Ext(info.Name()) != ".rego" {
return true
}
if !info.IsDir() && filepath.Ext(info.Name()) != ".rego" {
return true
}

return false
})
return false
})
if err != nil {
return nil, fmt.Errorf("filter rego files: %w", err)
}
Expand Down
Loading