Skip to content

Commit

Permalink
feat: update go lint (#665)
Browse files Browse the repository at this point in the history
* feat: update go lint

* added setup go

* deprecated linter

* fixed lint

* removed setup in linting
  • Loading branch information
naihsuanshao authored Oct 24, 2024
1 parent 0cd752c commit eb4a894
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
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

0 comments on commit eb4a894

Please sign in to comment.