Skip to content

"too many open files" in macOS High Sierra #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aaronbee opened this issue Jun 13, 2018 · 1 comment
Closed

"too many open files" in macOS High Sierra #102

aaronbee opened this issue Jun 13, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@aaronbee
Copy link

When running golangci-lint run on a repository with nearly 4000 .go files on macOS High Sierra, a "too man open files" error is encountered:

WARN[0015] running error: can't print 49 issues: can't read file path/to/file.go for printing issued line: open path/to/file.go: too many open files

macOS High Sierra defaults to an open file limit of 256, and can be increased for a shell session with ulimit -n.

Perhaps this issue can be documented in README.md. Or golangcli-lint can increase its open file limit with Setrlimit.

@jirfag jirfag added the bug Something isn't working label Jun 14, 2018
@jirfag
Copy link
Contributor

jirfag commented Jun 16, 2018

hi, thank you for the issue!
It's a file descriptor leak in errcheck: normal behavior is to get only 1 opened file at a time. I will fix it.

func readfile(filename string) []string {
	var f, err = os.Open(filename)
	if err != nil {
		return nil
	}

	var lines []string
	var scanner = bufio.NewScanner(f)
	for scanner.Scan() {
		lines = append(lines, scanner.Text())
	}
	return lines
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants