7 ms·
(int64, error) gives you exactly four possibilities. Either gives you exactly the two you want.
by premium-concern 10y ago
(int64, error)
gives you exactly four possibilities.
Either gives you exactly the two you want.
- weberc2 10y agoPlease feel free to enumerate them.
- premium-concern 10y ago(value, no error) (value, error) (no value, error) (no value, no error)
- leaveyou 10y agoThe convention is that if the err == nil then the value is not nil. The exceptions to this rule are very few and usually specified in the documentation. Normally you only have to check for error.
- bluejekyll 10y agoThe fact that it's a convention, and not a compiler error is the entire issue at debate here.
- weberc2 10y agoThere is no "no value" representation for int64. The only two cases are "<int64>, nil" or "<int64>, <error>".