Created
March 31, 2019 19:36
-
-
Save deankarn/b9d0698ed9fdc329cc6f7a446b8f0cea 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 mylib | |
import "net/http" | |
// Config contains all library configuration data | |
type Config struct { | |
Username string | |
Password string | |
} | |
type Instance struct { | |
client http.Client | |
} | |
// New create a new Instance of mylib | |
func New(c *Config) (*Instance, error) { | |
// create an http client where the basic credentials | |
// are injected automatically into requests. | |
client, err := // ... | |
return &Instance{ | |
client: client, | |
}, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment