Browse Source

Fix `else` block lint errors

pull/6/head
Matt Baer 6 years ago
parent
commit
8425a91fe1
3 changed files with 4 additions and 12 deletions
  1. +1
    -3
      auth.go
  2. +1
    -3
      collection.go
  3. +2
    -6
      post.go

+ 1
- 3
auth.go View File

@@ -38,10 +38,8 @@ func (c *Client) LogIn(username, pass string) (*AuthUser, error) {
return nil, fmt.Errorf("User does not exist.")
} else if status == http.StatusTooManyRequests {
return nil, fmt.Errorf("Stop repeatedly trying to log in.")
} else {
return nil, fmt.Errorf("Problem authenticating: %s. %v\n", status, err)
}
return u, nil
return nil, fmt.Errorf("Problem authenticating: %s. %v\n", status, err)
}

func (c *Client) isNotLoggedIn(code int) bool {


+ 1
- 3
collection.go View File

@@ -80,8 +80,6 @@ func (c *Client) CreateCollection(sp *CollectionParams) (*Collection, error) {
return nil, fmt.Errorf("Collection name is already taken.")
} else if status == http.StatusPreconditionFailed {
return nil, fmt.Errorf("Reached max collection quota.")
} else {
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
}
return p, nil
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
}

+ 2
- 6
post.go View File

@@ -81,10 +81,8 @@ func (c *Client) GetPost(id string) (*Post, error) {
return nil, fmt.Errorf("Post not found.")
} else if status == http.StatusGone {
return nil, fmt.Errorf("Post unpublished.")
} else {
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
}
return p, nil
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
}

// CreatePost publishes a new post, returning a user-friendly error if one comes
@@ -133,10 +131,8 @@ func (c *Client) UpdatePost(sp *PostParams) (*Post, error) {
return nil, fmt.Errorf("Not authenticated.")
} else if status == http.StatusBadRequest {
return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
} else {
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
}
return p, nil
return nil, fmt.Errorf("Problem getting post: %s. %v\n", status, err)
}

// DeletePost permanently deletes a published post. See


Loading…
Cancel
Save