@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.
@arielmt I remember disabling fast startup in Windows 10 because I'm dual booting Windows and Linux.
@kinsey @ky0ko Rob Pike and Ken Thompson were both part of the creation of utf-8 and go. The first implementation of utf-8 came out of the plan 9 project, which they were both part of, and if you have a look in the code you'll see the that rune is used in many of the variable names. So, it's no wonder that the character type is called rune in go.
Trans woman, bisexual, someone's fiancée, forever a programmer, poly, and former total mess
Avatar by mavica