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

feat: update go lint #665

Merged
merged 5 commits into from
Oct 24, 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
32 changes: 21 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@ jobs:
run: echo "::set-output name=matrix::$(ls -d */|sed -e 's/\///'|grep -v 'bless-ca\|scripts'|jq -cnR '[inputs | select(length>0)]')"
lint:
name: lint
runs-on: ubuntu-latest
runs-on: [ARM64, self-hosted, Linux]
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v1
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
terraform_version: 0.14.5
terraform_wrapper: "false"
- name: setup
run: make setup
- uses: golangci/golangci-lint-action@v3
app_id: ${{ secrets.CZI_GITHUB_HELPER_APP_ID }}
private_key: ${{ secrets.CZI_GITHUB_HELPER_PK }}
- uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: |
go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.56.2
args: --timeout=5m
github-token: ${{ secrets.GITHUB_TOKEN }}
version: v1.60.3
github-token: ${{ secrets.GITHUB_TOKEN }}

test:
name: test ${{ matrix.module }}
needs: get-modules
Expand Down
8 changes: 7 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ linters:
- gofmt
- whitespace
- unparam
- scopelint
- forbidigo
- gocritic

output:
formats:
- format: tab
show-stats: true
7 changes: 4 additions & 3 deletions aws-s3-public-bucket/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ func TestPublicBucketDefaults(t *testing.T) {
}

for _, test := range sims {
resp := tftest.S3SimulateRequest(t, region, test.action, test.arn, bucketPolicy, test.secureTransport)
fmt.Println("Testing ", test.action, " with https enabled=", test.secureTransport)
r.Equal(test.result, *resp.EvalDecision)
t.Run(fmt.Sprintf("Testing %s with https enabled=%t", test.action, test.secureTransport), func(t *testing.T) {
resp := tftest.S3SimulateRequest(t, region, test.action, test.arn, bucketPolicy, test.secureTransport)
r.Equal(test.result, *resp.EvalDecision)
})
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion bless-ca/test/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestBlessCAInitAndApply(t *testing.T) {
return tftest.Options(
region,
map[string]interface{}{
//test only
// test only
"region": region,
"bless_provider_aws_profile": tftest.EnvVar(tftest.EnvAWSProfile),
"test_user_name": fmt.Sprintf("bless-%s", tftest.UniqueID()),
Expand Down
Loading