[#148] linter: Add containedctx linter

Context has to be passed as an argument: https://pkg.go.dev/context

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-03-20 09:39:44 +03:00
parent 2dc86058c3
commit cc8ff015b4
22 changed files with 23 additions and 0 deletions

View file

@ -53,5 +53,6 @@ linters:
- predeclared
- reassign
- whitespace
- containedctx
disable-all: true
fast: false

View file

@ -297,6 +297,7 @@ func (a *applicationConfiguration) readConfig(c *config.Config) error {
// the application life cycle.
// It should not contain any read configuration values, component-specific
// helpers and fields.
// nolint: containedctx
type internals struct {
ctx context.Context
ctxCancel func()

View file

@ -363,6 +363,7 @@ func (p *remoteLoadAnnounceWriterProvider) InitWriter(ctx context.Context) (load
}, nil
}
// nolint: containedctx
type remoteLoadAnnounceWriter struct {
ctx context.Context

View file

@ -8,6 +8,7 @@ import (
)
// EpochContext is a std context extended with epoch data.
// nolint: containedctx
type EpochContext struct {
context.Context
E uint64

View file

@ -9,6 +9,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/reputation"
)
// nolint: containedctx
type commonPrm struct {
cli coreclient.Client

View file

@ -11,6 +11,7 @@ import (
)
// SearchSGPrm groups the parameters which are formed by Processor to search the storage group objects.
// nolint: containedctx
type SearchSGPrm struct {
Context context.Context
@ -25,6 +26,7 @@ type SearchSGDst struct {
}
// GetSGPrm groups parameter of GetSG operation.
// nolint: containedctx
type GetSGPrm struct {
Context context.Context

View file

@ -6,6 +6,7 @@ import (
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
)
// nolint: containedctx
type contextPrm struct {
ctx context.Context
}

View file

@ -26,6 +26,7 @@ type Option func(*cfg)
type Callback func()
// groups the configurations with default values.
// nolint: containedctx
type cfg struct {
ctx context.Context // neo-go client context

View file

@ -81,6 +81,7 @@ type ContextPrm struct {
pdpWorkerPool, porWorkerPool util.WorkerPool
}
// nolint: containedctx
type commonCommunicatorPrm struct {
Context context.Context

View file

@ -10,6 +10,7 @@ import (
)
// Task groups groups the container audit parameters.
// nolint: containedctx
type Task struct {
reporter Reporter

View file

@ -15,6 +15,7 @@ type StartPrm struct {
Epoch uint64
}
// nolint: containedctx
type commonContext struct {
epoch uint64

View file

@ -10,6 +10,7 @@ import (
"go.uber.org/zap"
)
// nolint: containedctx
type routeContext struct {
context.Context

View file

@ -18,6 +18,7 @@ type statusError struct {
err error
}
// nolint: containedctx
type execCtx struct {
svc *Service

View file

@ -19,6 +19,7 @@ type statusError struct {
err error
}
// nolint: containedctx
type execCtx struct {
svc *Service

View file

@ -18,6 +18,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
)
// nolint: containedctx
type commonPrm struct {
cli coreclient.Client

View file

@ -15,6 +15,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
)
// nolint: containedctx
type remoteTarget struct {
ctx context.Context

View file

@ -16,6 +16,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
)
// nolint: containedctx
type Streamer struct {
*cfg

View file

@ -16,6 +16,7 @@ type statusError struct {
err error
}
// nolint: containedctx
type execCtx struct {
svc *Service

View file

@ -136,6 +136,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add
}
}
// nolint: containedctx
type processPlacementContext struct {
context.Context

View file

@ -12,6 +12,7 @@ type ContinuePrm struct {
Epoch uint64
}
// nolint: containedctx
type iterContext struct {
context.Context

View file

@ -38,6 +38,7 @@ type IterationTrust struct {
// IterContext aggregates context and data required for
// iterations.
// nolint: containedctx
type IterContext struct {
context.Context
EpochIteration

View file

@ -51,6 +51,7 @@ type reportContext struct {
ctx common.Context
}
// nolint: containedctx
type iteratorContext struct {
context.Context