var origRlimitNofile … // Some systems set an artificially low soft limit on open file count, for compatibility // with code that uses select and its hard-coded maximum file descriptor // (limited by the size of fd_set). // // Go does not use select, so it should not be subject to these limits. // On some systems the limit is 256, which is very easy to run into, // even in simple programs like gofmt when they parallelize walking // a file tree. // // After a long discussion on go.dev/issue/46279, we decided the // best approach was for Go to raise the limit unconditionally for itself, // and then leave old software to set the limit back as needed. // Code that really wants Go to leave the limit alone can set the hard limit, // which Go of course has no choice but to respect. func init() { … } func Setrlimit(resource int, rlim *Rlimit) error { … }