Skip to content

Instantly share code, notes, and snippets.

@deankarn
Created March 31, 2019 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deankarn/2ebbc04dd65627a3a39b01e641846f7b to your computer and use it in GitHub Desktop.
Save deankarn/2ebbc04dd65627a3a39b01e641846f7b to your computer and use it in GitHub Desktop.
// config
c, err := mylib.New(&mylib.Config{
Username: "uname",
Password: "pw",
})
// methods
c, err := mylib.New("required")
if err !=nil{
// ...
}
c.BasicAuth("uname", "pw")
// function options
c, err := mylib.New("required", mylib.BasicAuth("uname", "pw"), ..)
// builder pattern
c, err := mylib.New("required").BasicAuth("uname", "pw").Build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment