Skip to content

Commit

Permalink
Fix function comments based on best practices from Effective Go
Browse files Browse the repository at this point in the history
Signed-off-by: CodeLingo Bot <[email protected]>
  • Loading branch information
CodeLingoBot committed Feb 28, 2019
1 parent f987588 commit d11ae3a
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 73 deletions.
8 changes: 4 additions & 4 deletions bounces.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (ci *BouncesIterator) Err() error {
return ci.err
}

// Retrieves the next page of items from the api. Returns false when there
// Next retrieves the next page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error
func (ci *BouncesIterator) Next(ctx context.Context, items *[]Bounce) bool {
Expand All @@ -82,7 +82,7 @@ func (ci *BouncesIterator) Next(ctx context.Context, items *[]Bounce) bool {
return true
}

// Retrieves the first page of items from the api. Returns false if there
// First retrieves the first page of items from the api. Returns false if there
// was an error. It also sets the iterator object to the first page.
// Use `.Err()` to retrieve the error.
func (ci *BouncesIterator) First(ctx context.Context, items *[]Bounce) bool {
Expand All @@ -99,7 +99,7 @@ func (ci *BouncesIterator) First(ctx context.Context, items *[]Bounce) bool {
return true
}

// Retrieves the last page of items from the api.
// Last retrieves the last page of items from the api.
// Calling Last() is invalid unless you first call First() or Next()
// Returns false if there was an error. It also sets the iterator object
// to the last page. Use `.Err()` to retrieve the error.
Expand All @@ -117,7 +117,7 @@ func (ci *BouncesIterator) Last(ctx context.Context, items *[]Bounce) bool {
return true
}

// Retrieves the previous page of items from the api. Returns false when there
// Previous retrieves the previous page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error if any
func (ci *BouncesIterator) Previous(ctx context.Context, items *[]Bounce) bool {
Expand Down
10 changes: 5 additions & 5 deletions credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ func (ri *CredentialsIterator) Err() error {
return ri.err
}

// Returns the current offset of the iterator
// Offset returns the current offset of the iterator
func (ri *CredentialsIterator) Offset() int {
return ri.offset
}

// Retrieves the next page of items from the api. Returns false when there
// Next retrieves the next page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error
func (ri *CredentialsIterator) Next(ctx context.Context, items *[]Credential) bool {
Expand All @@ -83,7 +83,7 @@ func (ri *CredentialsIterator) Next(ctx context.Context, items *[]Credential) bo
return true
}

// Retrieves the first page of items from the api. Returns false if there
// First retrieves the first page of items from the api. Returns false if there
// was an error. It also sets the iterator object to the first page.
// Use `.Err()` to retrieve the error.
func (ri *CredentialsIterator) First(ctx context.Context, items *[]Credential) bool {
Expand All @@ -101,7 +101,7 @@ func (ri *CredentialsIterator) First(ctx context.Context, items *[]Credential) b
return true
}

// Retrieves the last page of items from the api.
// Last retrieves the last page of items from the api.
// Calling Last() is invalid unless you first call First() or Next()
// Returns false if there was an error. It also sets the iterator object
// to the last page. Use `.Err()` to retrieve the error.
Expand Down Expand Up @@ -129,7 +129,7 @@ func (ri *CredentialsIterator) Last(ctx context.Context, items *[]Credential) bo
return true
}

// Retrieves the previous page of items from the api. Returns false when there
// Previous retrieves the previous page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error if any
func (ri *CredentialsIterator) Previous(ctx context.Context, items *[]Credential) bool {
Expand Down
16 changes: 8 additions & 8 deletions domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ func (ri *DomainsIterator) Err() error {
return ri.err
}

// Returns the current offset of the iterator
// Offset returns the current offset of the iterator
func (ri *DomainsIterator) Offset() int {
return ri.offset
}

// Retrieves the next page of items from the api. Returns false when there
// Next retrieves the next page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error
func (ri *DomainsIterator) Next(ctx context.Context, items *[]Domain) bool {
Expand All @@ -140,7 +140,7 @@ func (ri *DomainsIterator) Next(ctx context.Context, items *[]Domain) bool {
return true
}

// Retrieves the first page of items from the api. Returns false if there
// First retrieves the first page of items from the api. Returns false if there
// was an error. It also sets the iterator object to the first page.
// Use `.Err()` to retrieve the error.
func (ri *DomainsIterator) First(ctx context.Context, items *[]Domain) bool {
Expand All @@ -158,7 +158,7 @@ func (ri *DomainsIterator) First(ctx context.Context, items *[]Domain) bool {
return true
}

// Retrieves the last page of items from the api.
// Last retrieves the last page of items from the api.
// Calling Last() is invalid unless you first call First() or Next()
// Returns false if there was an error. It also sets the iterator object
// to the last page. Use `.Err()` to retrieve the error.
Expand Down Expand Up @@ -186,7 +186,7 @@ func (ri *DomainsIterator) Last(ctx context.Context, items *[]Domain) bool {
return true
}

// Retrieves the previous page of items from the api. Returns false when there
// Previous retrieves the previous page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error if any
func (ri *DomainsIterator) Previous(ctx context.Context, items *[]Domain) bool {
Expand Down Expand Up @@ -231,7 +231,7 @@ func (ri *DomainsIterator) fetch(ctx context.Context, skip, limit int) error {
return getResponseFromJSON(ctx, r, &ri.domainsListResponse)
}

// Retrieve detailed information about the named domain.
// GetDomain retrieves detailed information about the named domain.
func (mg *MailgunImpl) GetDomain(ctx context.Context, domain string) (DomainResponse, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain)
r.setClient(mg.Client())
Expand Down Expand Up @@ -298,7 +298,7 @@ func (mg *MailgunImpl) CreateDomain(ctx context.Context, name string, password s
return resp, err
}

// Returns delivery connection settings for the defined domain
// GetDomainConnection returns delivery connection settings for the defined domain
func (mg *MailgunImpl) GetDomainConnection(ctx context.Context, domain string) (DomainConnection, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/connection")
r.setClient(mg.Client())
Expand Down Expand Up @@ -330,7 +330,7 @@ func (mg *MailgunImpl) DeleteDomain(ctx context.Context, name string) error {
return err
}

// Returns tracking settings for a domain
// GetDomainTracking returns tracking settings for a domain
func (mg *MailgunImpl) GetDomainTracking(ctx context.Context, domain string) (DomainTracking, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/tracking")
r.setClient(mg.Client())
Expand Down
4 changes: 2 additions & 2 deletions email_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func NewEmailValidator(apiKey string) *EmailValidatorImpl {
}
}

// Return a new EmailValidator using environment variables
// NewEmailValidatorFromEnv returns a new EmailValidator using environment variables
// If MG_PUBLIC_API_KEY is set, assume using the free validation subject to daily usage limits
// If only MG_API_KEY is set, assume using the /private validation routes with no daily usage limits
func NewEmailValidatorFromEnv() (*EmailValidatorImpl, error) {
Expand Down Expand Up @@ -121,7 +121,7 @@ func (m *EmailValidatorImpl) Client() *http.Client {
return m.client
}

// Returns the API key used for validations
// APIKey returns the API key used for validations
func (m *EmailValidatorImpl) APIKey() string {
return m.apiKey
}
Expand Down
8 changes: 4 additions & 4 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (ei *EventIterator) Err() error {
return ei.err
}

// Retrieves the next page of events from the api. Returns false when there
// Next retrieves the next page of events from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error
func (ei *EventIterator) Next(ctx context.Context, events *[]Event) bool {
Expand All @@ -93,7 +93,7 @@ func (ei *EventIterator) Next(ctx context.Context, events *[]Event) bool {
return true
}

// Retrieves the first page of events from the api. Returns false if there
// First retrieves the first page of events from the api. Returns false if there
// was an error. It also sets the iterator object to the first page.
// Use `.Err()` to retrieve the error.
func (ei *EventIterator) First(ctx context.Context, events *[]Event) bool {
Expand All @@ -108,7 +108,7 @@ func (ei *EventIterator) First(ctx context.Context, events *[]Event) bool {
return true
}

// Retrieves the last page of events from the api.
// Last retrieves the last page of events from the api.
// Calling Last() is invalid unless you first call First() or Next()
// Returns false if there was an error. It also sets the iterator object
// to the last page. Use `.Err()` to retrieve the error.
Expand All @@ -124,7 +124,7 @@ func (ei *EventIterator) Last(ctx context.Context, events *[]Event) bool {
return true
}

// Retrieves the previous page of events from the api. Returns false when there
// Previous retrieves the previous page of events from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error if any
func (ei *EventIterator) Previous(ctx context.Context, events *[]Event) bool {
Expand Down
2 changes: 1 addition & 1 deletion exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (mg *MailgunImpl) ListExports(ctx context.Context, url string) ([]Export, e
return result, nil
}

// Get an export by id
// GetExport gets an export by id
func (mg *MailgunImpl) GetExport(ctx context.Context, id string) (Export, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, exportsEndpoint) + "/" + id)
r.setClient(mg.Client())
Expand Down
6 changes: 3 additions & 3 deletions ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type okResp struct {
Message string `json:"message"`
}

// Returns a list of IPs assigned to your account
// ListIPS returns a list of IPs assigned to your account
func (mg *MailgunImpl) ListIPS(ctx context.Context, dedicated bool) ([]IPAddress, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint))
r.setClient(mg.Client())
Expand All @@ -38,7 +38,7 @@ func (mg *MailgunImpl) ListIPS(ctx context.Context, dedicated bool) ([]IPAddress
return result, nil
}

// Returns information about the specified IP
// GetIP returns information about the specified IP
func (mg *MailgunImpl) GetIP(ctx context.Context, ip string) (IPAddress, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint) + "/" + ip)
r.setClient(mg.Client())
Expand All @@ -48,7 +48,7 @@ func (mg *MailgunImpl) GetIP(ctx context.Context, ip string) (IPAddress, error)
return resp, err
}

// Returns a list of IPs currently assigned to the specified domain.
// ListDomainIPS returns a list of IPs currently assigned to the specified domain.
func (mg *MailgunImpl) ListDomainIPS(ctx context.Context) ([]IPAddress, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips")
r.setClient(mg.Client())
Expand Down
2 changes: 1 addition & 1 deletion limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type TagLimits struct {
Count int `json:"count"`
}

// Returns tracking settings for a domain
// GetTagLimits returns tracking settings for a domain
func (mg *MailgunImpl) GetTagLimits(ctx context.Context, domain string) (TagLimits, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/limits/tag")
r.setClient(mg.Client())
Expand Down
2 changes: 1 addition & 1 deletion mailgun.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func NewMailgun(domain, apiKey string) *MailgunImpl {
}
}

// Return a new Mailgun client using the environment variables
// NewMailgunFromEnv returns a new Mailgun client using the environment variables
// MG_API_KEY, MG_DOMAIN, and MG_URL
func NewMailgunFromEnv() (*MailgunImpl, error) {
apiKey := os.Getenv("MG_API_KEY")
Expand Down
10 changes: 5 additions & 5 deletions mailing_lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (li *ListsIterator) Err() error {
return li.err
}

// Retrieves the next page of items from the api. Returns false when there
// Next retrieves the next page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error
func (li *ListsIterator) Next(ctx context.Context, items *[]MailingList) bool {
Expand All @@ -92,7 +92,7 @@ func (li *ListsIterator) Next(ctx context.Context, items *[]MailingList) bool {
return true
}

// Retrieves the first page of items from the api. Returns false if there
// First retrieves the first page of items from the api. Returns false if there
// was an error. It also sets the iterator object to the first page.
// Use `.Err()` to retrieve the error.
func (li *ListsIterator) First(ctx context.Context, items *[]MailingList) bool {
Expand All @@ -109,7 +109,7 @@ func (li *ListsIterator) First(ctx context.Context, items *[]MailingList) bool {
return true
}

// Retrieves the last page of items from the api.
// Last retrieves the last page of items from the api.
// Calling Last() is invalid unless you first call First() or Next()
// Returns false if there was an error. It also sets the iterator object
// to the last page. Use `.Err()` to retrieve the error.
Expand All @@ -127,7 +127,7 @@ func (li *ListsIterator) Last(ctx context.Context, items *[]MailingList) bool {
return true
}

// Retrieves the previous page of items from the api. Returns false when there
// Previous retrieves the previous page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error if any
func (li *ListsIterator) Previous(ctx context.Context, items *[]MailingList) bool {
Expand Down Expand Up @@ -215,7 +215,7 @@ func (mg *MailgunImpl) GetMailingList(ctx context.Context, addr string) (Mailing
return resp.MailingList, err
}

// UpdateList allows you to change various attributes of a list.
// UpdateMailingList allows you to change various attributes of a list.
// Address, Name, Description, and AccessLevel are all optional;
// only those fields which are set in the prototype will change.
//
Expand Down
8 changes: 4 additions & 4 deletions members.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (li *MemberListIterator) Err() error {
return li.err
}

// Retrieves the next page of items from the api. Returns false when there
// Next retrieves the next page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error
func (li *MemberListIterator) Next(ctx context.Context, items *[]Member) bool {
Expand All @@ -95,7 +95,7 @@ func (li *MemberListIterator) Next(ctx context.Context, items *[]Member) bool {
return true
}

// Retrieves the first page of items from the api. Returns false if there
// First retrieves the first page of items from the api. Returns false if there
// was an error. It also sets the iterator object to the first page.
// Use `.Err()` to retrieve the error.
func (li *MemberListIterator) First(ctx context.Context, items *[]Member) bool {
Expand All @@ -110,7 +110,7 @@ func (li *MemberListIterator) First(ctx context.Context, items *[]Member) bool {
return true
}

// Retrieves the last page of items from the api.
// Last retrieves the last page of items from the api.
// Calling Last() is invalid unless you first call First() or Next()
// Returns false if there was an error. It also sets the iterator object
// to the last page. Use `.Err()` to retrieve the error.
Expand All @@ -126,7 +126,7 @@ func (li *MemberListIterator) Last(ctx context.Context, items *[]Member) bool {
return true
}

// Retrieves the previous page of items from the api. Returns false when there
// Previous retrieves the previous page of items from the api. Returns false when there
// no more pages to retrieve or if there was an error. Use `.Err()` to retrieve
// the error if any
func (li *MemberListIterator) Previous(ctx context.Context, items *[]Member) bool {
Expand Down
4 changes: 2 additions & 2 deletions messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func (m *Message) AddDomain(domain string) {
m.domain = domain
}

// Retrieve the http headers associated with this message
// GetHeaders retrieves the http headers associated with this message
func (m *Message) GetHeaders() map[string]string {
return m.headers
}
Expand Down Expand Up @@ -747,7 +747,7 @@ func (mg *MailgunImpl) GetStoredMessageRawForURL(ctx context.Context, url string
return mg.GetStoredMessageRaw(ctx, url)
}

// Retrieves the raw MIME body of a received e-mail message attachment.
// GetStoredAttachment retrieves the raw MIME body of a received e-mail message attachment.
func (mg *MailgunImpl) GetStoredAttachment(ctx context.Context, url string) ([]byte, error) {
r := newHTTPRequest(url)
r.setClient(mg.Client())
Expand Down
2 changes: 1 addition & 1 deletion mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (ms *MockServer) Stop() {
ms.srv.Close()
}

// Return the URL used to connect to the mock server
// URL returns the URL used to connect to the mock server
func (ms *MockServer) URL() string {
return ms.srv.URL + "/v3"
}
Expand Down
Loading

0 comments on commit d11ae3a

Please sign in to comment.