There is no need to set rlimit in go 1.19

This commit is contained in:
9seconds
2022-08-04 10:58:31 +03:00
parent f9ad93dd06
commit 5ad64390d6
3 changed files with 0 additions and 38 deletions
-25
View File
@@ -1,25 +0,0 @@
//go:build !windows
// +build !windows
package utils
import (
"fmt"
"golang.org/x/sys/unix"
)
func SetLimits() error {
rLimit := unix.Rlimit{}
if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rLimit); err != nil {
return fmt.Errorf("cannot get rlimit: %w", err)
}
rLimit.Cur = rLimit.Max
if err := unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit); err != nil {
return fmt.Errorf("cannot set rlimit: %w", err)
}
return nil
}
-8
View File
@@ -1,8 +0,0 @@
//go:build windows
// +build windows
package utils
func SetLimits() error {
return nil
}
-5
View File
@@ -13,17 +13,12 @@ import (
"time"
"github.com/9seconds/mtg/v2/internal/cli"
"github.com/9seconds/mtg/v2/internal/utils"
"github.com/alecthomas/kong"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
if err := utils.SetLimits(); err != nil {
panic(err)
}
cli := &cli.CLI{}
ctx := kong.Parse(cli, kong.Vars{
"version": getVersion(),