Created
September 7, 2020 21:04
-
-
Save RicardoLinck/37baeea44a525a3614dc8ce014d669ed 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
var ErrInvalidAPIVersion = errors.New("invalid api version") | |
func getEndpoint(version int) (string, error) { | |
switch version { | |
case 1: | |
return "/api/v1/some-data", nil | |
case 2: | |
return "/api/v2/data", nil | |
default: | |
return "", ErrInvalidAPIVersion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment