[#148] linter: Add contextcheck linter
ci/woodpecker/push/full-pre-commit Pipeline failed Details
ci/woodpecker/push/pre-commit Pipeline was successful Details

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
pull/148/head
Dmitrii Stepanov 2023-03-20 15:10:53 +03:00
parent 481a1ca6f3
commit 44b86bac5a
8 changed files with 10 additions and 1 deletions

View File

@ -61,5 +61,6 @@ linters:
- containedctx - containedctx
- funlen - funlen
- gocognit - gocognit
- contextcheck
disable-all: true disable-all: true
fast: false fast: false

View File

@ -41,6 +41,7 @@ func (s *Server) DropObjects(_ context.Context, req *control.DropObjectsRequest)
prm.WithForceRemoval() prm.WithForceRemoval()
prm.WithAddress(addrList[i]) prm.WithAddress(addrList[i])
//nolint: contextcheck
_, err := s.s.Delete(prm) _, err := s.s.Delete(prm)
if err != nil && firstErr == nil { if err != nil && firstErr == nil {
firstErr = err firstErr = err

View File

@ -107,7 +107,7 @@ func (exec *execCtx) HeadObject(ctx context.Context, id oid.ID) (*objectSDK.Obje
w := NewSimpleObjectWriter() w := NewSimpleObjectWriter()
prm.SetHeaderWriter(w) prm.SetHeaderWriter(w)
//nolint: contextcheck
err := exec.svc.Head(exec.context(), prm) err := exec.svc.Head(exec.context(), prm)
if err != nil { if err != nil {
@ -128,6 +128,7 @@ func (exec *execCtx) GetObject(ctx context.Context, id oid.ID, rng *objectSDK.Ra
p.addr.SetContainer(exec.containerID()) p.addr.SetContainer(exec.containerID())
p.addr.SetObject(id) p.addr.SetObject(id)
//nolint: contextcheck
statusError := exec.svc.get(exec.context(), p.commonPrm, withPayloadRange(rng)) statusError := exec.svc.get(exec.context(), p.commonPrm, withPayloadRange(rng))
if statusError.err != nil { if statusError.err != nil {

View File

@ -78,6 +78,7 @@ func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) st
exec.setLogger(s.log) exec.setLogger(s.log)
//nolint: contextcheck
exec.execute() exec.execute()
return exec.statusError return exec.statusError

View File

@ -43,6 +43,7 @@ func (exec *execCtx) processNode(ctx context.Context, info client.NodeInfo) bool
// has already been streamed to the requesting party // has already been streamed to the requesting party
if obj != nil { if obj != nil {
exec.collectedObject = obj exec.collectedObject = obj
//nolint: contextcheck
exec.writeCollectedObject() exec.writeCollectedObject()
} }
case errors.As(err, &errRemoved): case errors.As(err, &errRemoved):

View File

@ -18,6 +18,7 @@ func (s *Service) Search(ctx context.Context, prm Prm) error {
exec.setLogger(s.log) exec.setLogger(s.log)
//nolint: contextcheck
exec.execute() exec.execute()
return exec.statusError.err return exec.statusError.err

View File

@ -81,6 +81,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add
prm.MarkAsGarbage(addrWithType.Address) prm.MarkAsGarbage(addrWithType.Address)
prm.WithForceRemoval() prm.WithForceRemoval()
//nolint: contextcheck
_, err := p.jobQueue.localStorage.Inhume(prm) _, err := p.jobQueue.localStorage.Inhume(prm)
if err != nil { if err != nil {
p.log.Error("could not inhume object with missing container", p.log.Error("could not inhume object with missing container",
@ -124,6 +125,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add
default: default:
} }
//nolint: contextcheck
p.processNodes(c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes) p.processNodes(c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes)
} }

View File

@ -94,6 +94,7 @@ func (s *Service) replicationWorker() {
func (s *Service) replicateLoop(ctx context.Context) { func (s *Service) replicateLoop(ctx context.Context) {
for i := 0; i < s.replicatorWorkerCount; i++ { for i := 0; i < s.replicatorWorkerCount; i++ {
//nolint: contextcheck
go s.replicationWorker() go s.replicationWorker()
go s.localReplicationWorker() go s.localReplicationWorker()
} }