Splintered failure modes in Go
A man with a watch knows what time it is. A man with two watches is never sure. — Segal’s Law Take this example: func validate(input string) (bool, error) { // Validation check 1 if input == "" { return false, nil } // Validation check 2 if isCorrupted(input) { return false, nil } // System check if err := checkUpstream(); err != nil { return false, err } return true, nil } This function returns two signals: a boolean to indicate if the string is valid, and an error to explain any problem the function might run into. ...