Better HN
topnewbestaskshowjobs
Log inSign up

throwawayfuzz

2 karma · joined Jul 29, 2017 (9y ago) · 2 submissions

Submissions

comment 9y ago · link · parent

Unfortunately, there are a number of correct uses of go that swallow errors. For example, fmt.Println returns an error, but you're just not going to see that error handled. Sometimes, it doesn't matter whether something has failed, because there's not a useful, proportionate thing you can do to respond to that failure. And it's not possible to know from machine examination which cases are which. I'm sure for some programs (grep?) a failure to emit a line to stdout is cause for failure. But for most it is not.

comment 9y ago · link · parent

If you want this behavior, you can just panic if an error is returned. Or you can divide the set of errors into expected and unexpected kinds, and panic only on the unexpected ones.

But the main reason this is the case is because in Go, errors are things that can arise from correctly behaving functions. If someone passes you invalid input, it's correct to return an error. You wouldn't want this to show up in as bad input in a fuzzer. Most fuzz test cases after all will not be correct input.