Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade golangci-lint to 1.52.2 #975

Merged
merged 5 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
version: v1.52.2

4 changes: 1 addition & 3 deletions pkg/conduit/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,7 @@ func (r *Runtime) serveHTTPAPI(

handler := grpcutil.WithWebsockets(
ctx,
grpcutil.WithDefaultGatewayMiddleware(
r.logger, allowCORS(gwmux, "http://localhost:4200"),
),
grpcutil.WithDefaultGatewayMiddleware(allowCORS(gwmux, "http://localhost:4200")),
r.logger,
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/connector/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (i *Instance) Inspect(ctx context.Context) *inspector.Session {
// when Open is called in the returned connector.
// If a connector is already running for this Instance this method returns an
// error.
func (i *Instance) Connector(ctx context.Context, dispenserFetcher PluginDispenserFetcher) (Connector, error) {
func (i *Instance) Connector(_ context.Context, dispenserFetcher PluginDispenserFetcher) (Connector, error) {
if i.connector != nil {
// connector is already running, might be a bug where an old connector is stuck
return nil, ErrConnectorRunning
Expand Down
4 changes: 2 additions & 2 deletions pkg/connector/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (s *Service) Check(ctx context.Context) error {

// List returns a map of Instances keyed by their ID. Instances do not
// necessarily have a running plugin associated with them.
func (s *Service) List(ctx context.Context) map[string]*Instance {
func (s *Service) List(context.Context) map[string]*Instance {
// make a copy of the map
tmp := make(map[string]*Instance, len(s.connectors))
for k, v := range s.connectors {
Expand All @@ -79,7 +79,7 @@ func (s *Service) List(ctx context.Context) map[string]*Instance {
}

// Get retrieves a single connector instance by ID.
func (s *Service) Get(ctx context.Context, id string) (*Instance, error) {
func (s *Service) Get(_ context.Context, id string) (*Instance, error) {
ins, ok := s.connectors[id]
if !ok {
return nil, cerrors.Errorf("%w (ID: %s)", ErrInstanceNotFound, id)
Expand Down
2 changes: 1 addition & 1 deletion pkg/connector/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestSource_Ack_Deadlock(t *testing.T) {
// testPluginFetcher fulfills the PluginFetcher interface.
type testPluginFetcher map[string]plugin.Dispenser

func (tpf testPluginFetcher) NewDispenser(logger log.CtxLogger, name string) (plugin.Dispenser, error) {
func (tpf testPluginFetcher) NewDispenser(_ log.CtxLogger, name string) (plugin.Dispenser, error) {
plug, ok := tpf[name]
if !ok {
return nil, plugin.ErrPluginNotFound
Expand Down
1 change: 1 addition & 0 deletions pkg/foundation/csync/valuewatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (vw *ValueWatcher[T]) subscribe() (chan T, func()) {
func (vw *ValueWatcher[T]) unsubscribe(id string, c chan T) {
// drain channel and remove it
go func() {
//nolint:revive // see comment below
for range c {
// Do nothing, just drain channel. In case another goroutine tries
// to store a new value by calling ValueWatcher.Set, this goroutine
Expand Down
2 changes: 1 addition & 1 deletion pkg/foundation/ctxutil/filepath.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func FilepathFromContext(ctx context.Context) string {
type FilepathLogCtxHook struct{}

// Run executes the log hook.
func (h FilepathLogCtxHook) Run(ctx context.Context, e *zerolog.Event, lvl zerolog.Level) {
func (h FilepathLogCtxHook) Run(ctx context.Context, e *zerolog.Event, _ zerolog.Level) {
p := FilepathFromContext(ctx)
if p != "" {
e.Str(log.FilepathField, p)
Expand Down
2 changes: 1 addition & 1 deletion pkg/foundation/ctxutil/messageid.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func MessageIDFromContext(ctx context.Context) string {
type MessageIDLogCtxHook struct{}

// Run executes the log hook.
func (h MessageIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, lvl zerolog.Level) {
func (h MessageIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, _ zerolog.Level) {
p := MessageIDFromContext(ctx)
if p != "" {
e.Str(log.MessageIDField, p)
Expand Down
2 changes: 1 addition & 1 deletion pkg/foundation/ctxutil/requestid.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func RequestIDFromContext(ctx context.Context) string {
type RequestIDLogCtxHook struct{}

// Run executes the log hook.
func (h RequestIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, lvl zerolog.Level) {
func (h RequestIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, _ zerolog.Level) {
p := RequestIDFromContext(ctx)
if p != "" {
e.Str(log.RequestIDField, p)
Expand Down
2 changes: 1 addition & 1 deletion pkg/foundation/database/inmemory/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (t *Txn) Discard() {
// do nothing
}

func (d *DB) NewTransaction(ctx context.Context, update bool) (database.Transaction, context.Context, error) {
func (d *DB) NewTransaction(ctx context.Context, _ bool) (database.Transaction, context.Context, error) {
d.m.Lock()
defer d.m.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion pkg/foundation/grpcutil/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func WithErrorHandler(logger log.CtxLogger) runtime.ServeMuxOption {

// WithDefaultGatewayMiddleware wraps the handler with the default GRPC Gateway
// middleware.
func WithDefaultGatewayMiddleware(logger log.CtxLogger, h http.Handler) http.Handler {
func WithDefaultGatewayMiddleware(h http.Handler) http.Handler {
middleware := []func(http.Handler) http.Handler{
WithPrettyJSONHeader,
WithHTTPEndpointHeader,
Expand Down
1 change: 1 addition & 0 deletions pkg/foundation/grpcutil/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ func (p *webSocketProxy) startWebSocketWrite(ctx context.Context, messages chan
defer func() {
ticker.Stop()
cancelFn()
//nolint:revive // draining the channel
for range messages {
// throw away
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/foundation/log/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type componentHook struct {
}

// Run executes the componentHook.
func (ch componentHook) Run(ctx context.Context, e *zerolog.Event, l zerolog.Level) {
func (ch componentHook) Run(_ context.Context, e *zerolog.Event, _ zerolog.Level) {
if ch.name != "" {
e.Str(ComponentField, ch.name)
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/foundation/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mockgen -destination=mock/metrics.go -package=mock -mock_names=Counter=Counter,LabeledCounter=LabeledCounter,Gauge=Gauge,LabeledGauge=LabeledGauge,Timer=Timer,LabeledTimer=LabeledTimer . Counter,LabeledCounter,Gauge,LabeledGauge,Timer,LabeledTimer

package metrics

import (
Expand Down
Loading