Skip to content

Instantly share code, notes, and snippets.

@reetasingh
Last active May 4, 2023 03:19
Show Gist options
  • Save reetasingh/9a989b9229e959e8f1d553fff11df867 to your computer and use it in GitHub Desktop.
Save reetasingh/9a989b9229e959e8f1d553fff11df867 to your computer and use it in GitHub Desktop.
save function throwing error in one case and not throwing error in another case
type mockTestDB1 struct {}
type mockTestDB2 struct {}
func (m *mockTestDB1) Save(person *Person) error {
// case 1
return nil
}
func (m *mockTestDB2) Save(person *Person) error {
// case 2
return fmt.Errorf("error in save")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment