Created
August 25, 2020 16:38
-
-
Save tylerstillwater/ceca63e402734ff4e06926d167e19760 to your computer and use it in GitHub Desktop.
$ERR$ doesn't detect custom error type
This file contains 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 MyError struct { | |
Code int | |
Message string | |
} | |
func (m MyError) Error() string { | |
return fmt.Sprintf("%d: %s",m.Code,m.Message) | |
} | |
func ReturnError() MyError { | |
return MyError{ | |
Code:1, | |
Message:"kaboom", | |
} | |
} | |
func main(){ | |
err := ReturnError() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment