Last active
August 22, 2019 01:50
-
-
Save softwarebygabe/62ee65ba0d83cd4d5e4d54e78fb6d062 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 foo | |
import ( | |
"errors" | |
) | |
type IExternalClient interface { | |
GetData() (string, error) | |
} | |
func Controller(externalClient IExternalClient) error { | |
fromExternalAPI, err := externalClient.GetData() | |
if err != nil { | |
return err | |
} | |
// do some things based on data from external API | |
if fromExternalAPI != "data" { | |
return errors.New("unexpected data") | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment