forked from TrueCloudLab/frostfs-node
[#1718] linter: Resolve gocritic's singleCaseSwitch linter
See https://go-critic.com/overview#singlecaseswitch for details. Change-Id: Ied7885f83b4116969771de6f91bc5e1e3b2a4f1e Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
8d499f03fe
commit
64900f87e1
3 changed files with 5 additions and 10 deletions
|
@ -67,12 +67,9 @@ func (w *genericWriter) writeAndRename(tmpPath, p string, data []byte) error {
|
|||
err := w.writeFile(tmpPath, data)
|
||||
if err != nil {
|
||||
var pe *fs.PathError
|
||||
if errors.As(err, &pe) {
|
||||
switch pe.Err {
|
||||
case syscall.ENOSPC:
|
||||
err = common.ErrNoSpace
|
||||
_ = os.RemoveAll(tmpPath)
|
||||
}
|
||||
if errors.As(err, &pe) && errors.Is(pe.Err, syscall.ENOSPC) {
|
||||
err = common.ErrNoSpace
|
||||
_ = os.RemoveAll(tmpPath)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -35,8 +35,7 @@ func panicOnPrmValue(n string, v any) {
|
|||
// the parameterized private key.
|
||||
func New(prm Prm, netmapClient *netmap.Client, containerClient *container.Client, opts ...Option) *Server {
|
||||
// verify required parameters
|
||||
switch {
|
||||
case prm.healthChecker == nil:
|
||||
if prm.healthChecker == nil {
|
||||
panicOnPrmValue("health checker", prm.healthChecker)
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,7 @@ func New(prm HTTPSrvPrm, opts ...Option) *Server {
|
|||
o(c)
|
||||
}
|
||||
|
||||
switch {
|
||||
case c.shutdownTimeout <= 0:
|
||||
if c.shutdownTimeout <= 0 {
|
||||
panicOnOptValue("shutdown timeout", c.shutdownTimeout)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue