nilaway
nilaway copied to clipboard
not detected
package main
import (
"bytes"
"io"
)
func fn(out io.Writer) {
if out != nil {
out.Write([]byte("OK\n"))
}
}
func main() {
// case 1: detected
var a *int
b := *a // panic
println(b)
// case 2: not detected
var buf *bytes.Buffer = nil
fn(buf) // panic
}