[#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:
Dmitrii Stepanov 2025-04-16 14:44:00 +03:00
parent 8d499f03fe
commit 64900f87e1
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
3 changed files with 5 additions and 10 deletions

View file

@ -67,12 +67,9 @@ func (w *genericWriter) writeAndRename(tmpPath, p string, data []byte) error {
err := w.writeFile(tmpPath, data) err := w.writeFile(tmpPath, data)
if err != nil { if err != nil {
var pe *fs.PathError var pe *fs.PathError
if errors.As(err, &pe) { if errors.As(err, &pe) && errors.Is(pe.Err, syscall.ENOSPC) {
switch pe.Err { err = common.ErrNoSpace
case syscall.ENOSPC: _ = os.RemoveAll(tmpPath)
err = common.ErrNoSpace
_ = os.RemoveAll(tmpPath)
}
} }
return err return err
} }

View file

@ -35,8 +35,7 @@ func panicOnPrmValue(n string, v any) {
// the parameterized private key. // the parameterized private key.
func New(prm Prm, netmapClient *netmap.Client, containerClient *container.Client, opts ...Option) *Server { func New(prm Prm, netmapClient *netmap.Client, containerClient *container.Client, opts ...Option) *Server {
// verify required parameters // verify required parameters
switch { if prm.healthChecker == nil {
case prm.healthChecker == nil:
panicOnPrmValue("health checker", prm.healthChecker) panicOnPrmValue("health checker", prm.healthChecker)
} }

View file

@ -76,8 +76,7 @@ func New(prm HTTPSrvPrm, opts ...Option) *Server {
o(c) o(c)
} }
switch { if c.shutdownTimeout <= 0 {
case c.shutdownTimeout <= 0:
panicOnOptValue("shutdown timeout", c.shutdownTimeout) panicOnOptValue("shutdown timeout", c.shutdownTimeout)
} }