While reading the source code of Go program for dealing with program memory I found this snippet of code:
f, err := p.openFile("mem")
if err != nil {
return nil, err
}
defer func() { _ = f.Close() }()
Notice the last line. Why it defers a closure with _ = f.Close() instead of just defer f.Close()?
My guess is satisfying the linter which hates unused return values. But what is the real reason for using closure in this case?