@kinsey It's also kind of a go idiom what nil values *should* be valid if possible.
So, I guess that while a nil *os.File is not a valid open file its a "valid" *os.File, in the sense that you can call all the methods and expect to get an error in return instead of panicking. 🤷♀️
@kinsey I'll return an error, yea, but you can just ignore the return value in that case.
@kinsey If os.Open (or os.Create) returns an error then the file pointer returned will be nil. So defer file.Close() would be... not ok.. wait? No, you can call Close() on a nil *os.File!
TIL
mh-
I turned off my alarms to make sure I get enough sleep, but I think that in the long run that makes it worse. I've been going in late to work several days in a row. Luckily I have access to work from home so I don't work that much less. But that also I think makes it worse in the long run.
Trans woman, bisexual, someone's fiancée, forever a programmer, poly, and former total mess
Avatar by mavica