Skip to content

Commit

Permalink
drop old terraform version/add news and enable golangci-lint (#168)
Browse files Browse the repository at this point in the history
- drop old terraform versions
- add new terraform versions
- enable golangci-lint
- fix lints
  • Loading branch information
cpanato authored Sep 11, 2024
1 parent 8a251d4 commit a5dbdbb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ jobs:
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
- run: go mod download
- run: go build -v .
# - name: Run linters
# uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
# with:
# version: latest
- run: |
go mod download
go build -v .
generate:
runs-on: ubuntu-latest
Expand All @@ -60,10 +57,9 @@ jobs:
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.5.*'
- '1.6.*'
- '1.7.*'
- '1.8.*'
- '1.9.*'
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
Expand All @@ -79,3 +75,17 @@ jobs:
TF_ACC: "1"
run: go test -v -cover ./internal/provider/
timeout-minutes: 10

golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
with:
version: v1.60
11 changes: 6 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Visit https://golangci-lint.run/ for usage documentation
# and information on other useful linters
---
run:
timeout: 5m

issues:
max-per-linter: 0
max-issues-per-linter: 0
max-same-issues: 0

linters:
disable-all: true
enable:
- durationcheck
- errcheck
- exportloopref
- forcetypeassert
- godot
- gofmt
Expand All @@ -24,4 +25,4 @@ linters:
- unconvert
- unparam
- unused
- vet

4 changes: 3 additions & 1 deletion internal/provider/append_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ func (r *AppendResource) doAppend(ctx context.Context, data *AppendResourceModel
return nil, []diag.Diagnostic{diag.NewErrorDiagnostic("Unable to close gzip writer", fmt.Sprintf("Unable to close gzip writer, got error: %s", err))}
}

l, err := tarball.LayerFromReader(&b)
l, err := tarball.LayerFromOpener(func() (io.ReadCloser, error) {
return io.NopCloser(bytes.NewBuffer(b.Bytes())), nil
})
if err != nil {
return nil, []diag.Diagnostic{diag.NewErrorDiagnostic("Unable to create layer", fmt.Sprintf("Unable to create layer, got error: %s", err))}
}
Expand Down

0 comments on commit a5dbdbb

Please sign in to comment.