Remove juju/errors

This commit is contained in:
9seconds
2019-09-06 16:10:55 +03:00
parent 701f62ed4c
commit 2918ed11e5
19 changed files with 73 additions and 91 deletions
+8 -11
View File
@@ -3,24 +3,21 @@
package utils
import (
"golang.org/x/sys/unix"
"fmt"
"github.com/juju/errors"
"golang.org/x/sys/unix"
)
func SetLimits() (err error) {
func SetLimits() error {
rLimit := unix.Rlimit{}
err = unix.Getrlimit(unix.RLIMIT_NOFILE, &rLimit)
if err != nil {
err = errors.Annotate(err, "Cannot get rlimit")
return
if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rLimit); err != nil {
return fmt.Errorf("cannot get rlimit: %w", err)
}
rLimit.Cur = rLimit.Max
err = unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit)
if err != nil {
err = errors.Annotate(err, "Cannot set rlimit")
if err := unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit); err != nil {
return fmt.Errorf("cannot set rlimit: %w", err)
}
return
return nil
}