Created
July 17, 2015 19:23
-
-
Save paulp/a7bb0df9e1fe4efc0a60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type SomeError struct { string } | |
var err *SomeError | |
func (x *SomeError) Error()string { return x.string } | |
func MaybeLog(err error) { | |
if err != nil { | |
fmt.Printf("MaybeLog Error: %v %T\n", err, err) | |
} | |
} | |
func main() { | |
if err != nil { | |
fmt.Printf("Main Error: %v %T\n", err, err) | |
} | |
MaybeLog(err) | |
} | |
/** Output: | |
MaybeLog Error: <nil> *main.SomeError | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment