Skip to content

Commit c33293e

Browse files
authored
Merge pull request #100 from Backblaze/go-vet
Use go vet for linting
2 parents 383a0ab + fba18ba commit c33293e

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ website/vendor
3737

3838
# Go
3939
.go-version
40-
pkged.go
4140

4241
# Provider binary
4342
/terraform-provider-b2

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
### Infrastructure
1414
* Upgrade pyinstaller to 6.11.1
15+
* Use `go vet` for linting
1516

1617
### Fixed
1718
* Fix an issue with missing `content_md5` in case the file has been uploaded as a large file

GNUmakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ format: _pybindings
3434
@terraform fmt -recursive ./examples/
3535

3636
lint: _pybindings
37-
@python scripts/check-gofmt.py '**/*.go' pkged.go
38-
@python scripts/check-headers.py '**/*.go' pkged.go
37+
@python scripts/check-gofmt.py '**/*.go'
38+
@python scripts/check-headers.py '**/*.go'
39+
@test -f b2/py-terraform-provider-b2 || touch b2/py-terraform-provider-b2 # required by go:embed in bindings.go
40+
@go vet ./...
3941

4042
testacc: _pybindings
4143
@cp python-bindings/dist/py-terraform-provider-b2 b2/

b2/client.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ func (c Client) apply(ctx context.Context, name string, op string, input map[str
7373
if err != nil {
7474
if exitErr, ok := err.(*exec.ExitError); ok {
7575
if exitErr.Stderr != nil && len(exitErr.Stderr) > 0 {
76+
err := fmt.Errorf("%s", string(exitErr.Stderr))
7677
tflog.Error(ctx, "Error in pybindings", map[string]interface{}{
77-
"stderr": fmt.Errorf(string(exitErr.Stderr)),
78+
"stderr": err,
7879
})
79-
return nil, fmt.Errorf(string(exitErr.Stderr))
80+
return nil, err
8081
}
8182
return nil, fmt.Errorf("failed to execute")
8283
} else {
@@ -118,6 +119,11 @@ func (c Client) apply(ctx context.Context, name string, op string, input map[str
118119
}
119120

120121
func (c Client) populate(ctx context.Context, name string, op string, output map[string]interface{}, d *schema.ResourceData) error {
122+
tflog.Info(ctx, "Populating data from pybindings", map[string]interface{}{
123+
"name": name,
124+
"op": op,
125+
})
126+
121127
resourceName := "b2_" + name
122128
var schemaList []string
123129
if op == DATA_SOURCE_READ {

0 commit comments

Comments
 (0)