In defense of the := syntax, the shorthand operator
alone does not cause the problem, but only in combination with the if block creating a new scope. Try
fileInfo, err := os.Stat("/...")
if err != nil {
and the panic will also be gone.
I never use the "if <assignment>; <condition>" syntax because I find it too convoluted. The shadowing problem is another good reason for not using that syntax.