Last active
June 8, 2021 06:46
-
-
Save scriptonist/788c1743d8f9f86dfa96e3ec4647608e to your computer and use it in GitHub Desktop.
Revisions
-
scriptonist revised this gist
Jun 8, 2021 . 1 changed file with 37 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ package main import ( "fmt" ) type CustomError interface { additionalInfo() string error } type Err struct { m string } func (e *Err) additionalInfo() string { return "additional info" } func (e *Err) Error() string { return e.m } func getError() CustomError { return nil } func main() { err := fmt.Errorf("test") err = getError() if err != nil { fmt.Printf("got error") return } fmt.Printf("no error") } -
scriptonist created this gist
Mar 25, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ package main import ( "fmt" ) type Err struct { m string } func (e *Err) Error() string { return e.m } func getError() *Err { return nil } func main() { err := fmt.Errorf("test") err = getError() if err != nil { fmt.Printf("got error") return } fmt.Printf("no error") }