Skip to content

Instantly share code, notes, and snippets.

@tylerstillwater
Created August 25, 2020 16:38
Show Gist options
  • Save tylerstillwater/ceca63e402734ff4e06926d167e19760 to your computer and use it in GitHub Desktop.
Save tylerstillwater/ceca63e402734ff4e06926d167e19760 to your computer and use it in GitHub Desktop.
$ERR$ doesn't detect custom error type
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