Skip to content

Commit

Permalink
Fix linting issues by excluding tests and fake server
Browse files Browse the repository at this point in the history
  • Loading branch information
afritzler committed Oct 28, 2024
1 parent 4d0c4b4 commit 5ade639
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ linters-settings:
alias: ${1}client

issues:
# exclude copylocks issues in fake servers and unit tests
exclude-files:
- iri/testing/volume/fake.go
- iri/testing/bucket/fake.go
- iri/testing/machine/fake.go
- poollet/machinepoollet/controllers/machine_controller_test.go
# TODO: fis copylocks issues in those files
- poollet/volumepoollet/vcm/generic.go
- poollet/bucketpoollet/bcm/generic.go
# don't skip warning about doc comments
# don't exclude the default set of lint
exclude-use-default: false
Expand Down
4 changes: 2 additions & 2 deletions broker/machinebroker/cmd/machinebroker/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func Run(ctx context.Context, opts Options) error {

g, ctx := errgroup.WithContext(ctx)
g.Go(func() error {
return runServer(ctx, setupLog, log, srv)
return runServer(ctx, setupLog, srv)
})
g.Go(func() error {
return runGRPCServer(ctx, setupLog, log, srv, opts)
Expand All @@ -133,7 +133,7 @@ func Run(ctx context.Context, opts Options) error {
return g.Wait()
}

func runServer(ctx context.Context, setupLog, _ logr.Logger, srv *server.Server) error {
func runServer(ctx context.Context, setupLog logr.Logger, srv *server.Server) error {
setupLog.V(1).Info("Starting server loops")
if err := srv.Start(ctx); err != nil {
return fmt.Errorf("error starting server loops: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ironcore-dev/ironcore
go 1.23.2

require (
github.com/afritzler/protoequal v0.1.0
github.com/afritzler/protoequal v0.1.1
github.com/bits-and-blooms/bitset v1.14.3
github.com/blang/semver/v4 v4.0.0
github.com/go-chi/chi/v5 v5.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOEl
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
github.com/afritzler/protoequal v0.1.0 h1:2D3rLHXQB+wzPOJHuG3H7p/H16g3pEQwyvtkNkS1pYs=
github.com/afritzler/protoequal v0.1.0/go.mod h1:Ube4ogd+UZ3f8PfmeQfO2SJBCLHT6gmkEtpqvXmJhBU=
github.com/afritzler/protoequal v0.1.1 h1:t3jAXLzRrVbkUg3Hom7rQdUck2kpAgR5JD9/68Lht90=
github.com/afritzler/protoequal v0.1.1/go.mod h1:Ube4ogd+UZ3f8PfmeQfO2SJBCLHT6gmkEtpqvXmJhBU=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
Expand Down
2 changes: 0 additions & 2 deletions hack/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
package hack

import (
// Use gogoproto for protobuf generation.
_ "github.com/gogo/protobuf/gogoproto"
_ "k8s.io/code-generator"
)
3 changes: 2 additions & 1 deletion poollet/bucketpoollet/bcm/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ func (g *Generic) GetBucketClassFor(ctx context.Context, name string, caps *iri.
case 0:
return nil, ErrNoMatchingBucketClass
case 1:
return byCaps[0], nil
class := *byCaps[0]
return &class, nil
default:
return nil, ErrAmbiguousMatchingBucketClass
}
Expand Down
3 changes: 2 additions & 1 deletion poollet/volumepoollet/vcm/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ func (g *Generic) GetVolumeClassFor(ctx context.Context, name string, caps *iri.
case 0:
return nil, nil, ErrNoMatchingVolumeClass
case 1:
return byCaps[0].VolumeClass, resource.NewQuantity(byCaps[0].Quantity, resource.BinarySI), nil
classStatus := *byCaps[0]
return classStatus.VolumeClass, resource.NewQuantity(classStatus.Quantity, resource.BinarySI), nil
default:
return nil, nil, ErrAmbiguousMatchingVolumeClass
}
Expand Down

0 comments on commit 5ade639

Please sign in to comment.