forked from TrueCloudLab/frostfs-sdk-go
[#114] pool: Fix linter errors
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
518fb79bc0
commit
cae215534f
2 changed files with 9 additions and 4 deletions
|
@ -24,7 +24,13 @@ func NewPartBufferPool(limit uint64, maxObjectSize uint64) *PartsBufferPool {
|
|||
limit: limit,
|
||||
maxObjectSize: maxObjectSize,
|
||||
available: limit,
|
||||
syncPool: &sync.Pool{New: func() any { return make([]byte, maxObjectSize) }},
|
||||
syncPool: &sync.Pool{New: func() any {
|
||||
// We have to use pointer (even for slices), see https://staticcheck.dev/docs/checks/#SA6002
|
||||
// It's based on interfaces implementation in 2016, so maybe something has changed since then.
|
||||
// We can use no pointer for multi-kilobyte slices though https://github.com/golang/go/issues/16323#issuecomment-254401036
|
||||
buff := make([]byte, maxObjectSize)
|
||||
return &buff
|
||||
}},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +49,7 @@ func (p *PartsBufferPool) GetBuffer() (*PartBuffer, error) {
|
|||
p.available -= p.maxObjectSize
|
||||
|
||||
return &PartBuffer{
|
||||
Buffer: p.syncPool.Get().([]byte),
|
||||
Buffer: *p.syncPool.Get().(*[]byte),
|
||||
len: p.maxObjectSize,
|
||||
}, nil
|
||||
}
|
||||
|
@ -58,7 +64,7 @@ func (p *PartsBufferPool) FreeBuffer(buff *PartBuffer) error {
|
|||
}
|
||||
|
||||
p.available += buff.len
|
||||
p.syncPool.Put(buff.Buffer)
|
||||
p.syncPool.Put(&buff.Buffer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -2129,7 +2129,6 @@ func initSessionForDuration(ctx context.Context, dst *session.Object, c client,
|
|||
if clientCut {
|
||||
id = uuid.New()
|
||||
key = frostfsecdsa.PublicKey(ownerKey.PublicKey)
|
||||
|
||||
} else {
|
||||
res, err := c.sessionCreate(ctx, prm)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue