Skip to content

Commit

Permalink
Upgrade golangci-lint version to v1.60.x (#267)
Browse files Browse the repository at this point in the history
This commit includes changes needed to make the stricter linter pass.
  • Loading branch information
iwahbe authored Aug 27, 2024
1 parent d79eaa3 commit b3cf388
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stage-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:

jobs:
lint:
container: golangci/golangci-lint:v1.59
container: golangci/golangci-lint:v1.60
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
Expand Down
11 changes: 11 additions & 0 deletions middleware/rpc/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ package rpc
import (
"context"
"errors"
"fmt"
"math"

structpb "github.com/golang/protobuf/ptypes/struct"
"github.com/pulumi/pulumi-go-provider/internal/key"
Expand All @@ -42,7 +44,16 @@ func Provider(server rpc.ResourceProviderServer) p.Provider {
var runtime runtime // the runtime configuration of the server
return p.Provider{
GetSchema: func(ctx context.Context, req p.GetSchemaRequest) (p.GetSchemaResponse, error) {
if req.Version > math.MaxInt32 {
return p.GetSchemaResponse{}, fmt.Errorf("schema version overflow: %d", req.Version)
}
if req.Version < math.MinInt32 {
return p.GetSchemaResponse{}, fmt.Errorf("schema version underflow: %d", req.Version)
}
s, err := server.GetSchema(ctx, &rpc.GetSchemaRequest{
//cast validated above
//
//nolint:gosec
Version: int32(req.Version),
})
return p.GetSchemaResponse{
Expand Down
4 changes: 2 additions & 2 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ type errCollectingContext struct {

func (e *errCollectingContext) Log(severity diag.Severity, msg string) {
if severity == diag.Error {
e.errs.Errors = append(e.errs.Errors, fmt.Errorf(msg))
e.errs.Errors = append(e.errs.Errors, errors.New(msg))
}
_, err := fmt.Fprintf(e.stderr, "Log(%s): %s\n", severity, msg)
contract.IgnoreError(err)
Expand All @@ -465,7 +465,7 @@ func (e *errCollectingContext) Logf(severity diag.Severity, msg string, args ...

func (e *errCollectingContext) LogStatus(severity diag.Severity, msg string) {
if severity == diag.Error {
e.errs.Errors = append(e.errs.Errors, fmt.Errorf(msg))
e.errs.Errors = append(e.errs.Errors, errors.New(msg))
}
_, err := fmt.Fprintf(e.stderr, "LogStatus(%s): %s\n", severity, msg)
contract.IgnoreError(err)
Expand Down

0 comments on commit b3cf388

Please sign in to comment.