mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-13 12:18:00 +08:00
align kubo with unified golang ci linter from IPDX and rules used in boxo and other go packages addressed lint rules: - ST1000: added package comments - ST1020, ST1021, ST1022: fixed function/method comments - QF1001: applied De Morgan's law - QF1003: converted if-else chains to tagged switches - QF1004: replaced strings.Replace with strings.ReplaceAll - QF1008: simplified embedded struct field selectors - unconvert: removed unnecessary type conversions - usestdlibvars: used stdlib constants instead of literals disabled errcheck linter in .golangci.yml
18 lines
302 B
Go
18 lines
302 B
Go
//go:build linux || darwin
|
|
// +build linux darwin
|
|
|
|
// Package fd provides file descriptor management utilities.
|
|
package fd
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func GetNumFDs() int {
|
|
var l unix.Rlimit
|
|
if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &l); err != nil {
|
|
return 0
|
|
}
|
|
return int(l.Cur)
|
|
}
|