1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-03-23 21:09:19 +02:00

Cleaning a bunch of go vet issues

This commit is contained in:
Bob Briski 2018-02-28 22:46:54 -08:00
parent 78dbcf28a8
commit 56d87db29c
6 changed files with 49 additions and 48 deletions

View File

@ -121,7 +121,7 @@ func (s *AuthenticationService) Authenticated() bool {
// client anymore // client anymore
func (s *AuthenticationService) Logout() error { func (s *AuthenticationService) Logout() error {
if s.authType != authTypeSession || s.client.session == nil { if s.authType != authTypeSession || s.client.session == nil {
return fmt.Errorf("No user is authenticated yet.") return fmt.Errorf("no user is authenticated")
} }
apiEndpoint := "rest/auth/1/session" apiEndpoint := "rest/auth/1/session"

View File

@ -399,6 +399,7 @@ type WorklogRecord struct {
ID string `json:"id,omitempty" structs:"id,omitempty"` ID string `json:"id,omitempty" structs:"id,omitempty"`
IssueID string `json:"issueId,omitempty" structs:"issueId,omitempty"` IssueID string `json:"issueId,omitempty" structs:"issueId,omitempty"`
} }
// TimeTracking represents the timetracking fields of a JIRA issue. // TimeTracking represents the timetracking fields of a JIRA issue.
type TimeTracking struct { type TimeTracking struct {
OriginalEstimate string `json:"originalEstimate,omitempty" structs:"originalEstimate,omitempty"` OriginalEstimate string `json:"originalEstimate,omitempty" structs:"originalEstimate,omitempty"`
@ -674,11 +675,11 @@ func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
return &ret, resp, nil return &ret, resp, nil
} }
// Update updates an issue from a JSON representation. The issue is found by key. // UpdateIssue updates an issue from a JSON representation. The issue is found by key.
// //
// https://docs.atlassian.com/jira/REST/7.4.0/#api/2/issue-editIssue // https://docs.atlassian.com/jira/REST/7.4.0/#api/2/issue-editIssue
func (s *IssueService) UpdateIssue(jiraId string, data map[string]interface{}) (*Response, error) { func (s *IssueService) UpdateIssue(jiraID string, data map[string]interface{}) (*Response, error) {
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", jiraId) apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", jiraID)
req, err := s.client.NewRequest("PUT", apiEndpoint, data) req, err := s.client.NewRequest("PUT", apiEndpoint, data)
if err != nil { if err != nil {
return nil, err return nil, err
@ -949,7 +950,7 @@ func InitIssueWithMetaAndFields(metaProject *MetaProject, metaIssuetype *MetaIss
for key, value := range fieldsConfig { for key, value := range fieldsConfig {
jiraKey, found := allFields[key] jiraKey, found := allFields[key]
if !found { if !found {
return nil, fmt.Errorf("Key %s is not found in the list of fields.", key) return nil, fmt.Errorf("key %s is not found in the list of fields", key)
} }
valueType, err := metaIssuetype.Fields.String(jiraKey + "/schema/type") valueType, err := metaIssuetype.Fields.String(jiraKey + "/schema/type")
@ -1030,9 +1031,9 @@ func (s *IssueService) Delete(issueID string) (*Response, error) {
// //
// JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-getIssueWatchers // JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-getIssueWatchers
func (s *IssueService) GetWatchers(issueID string) (*[]User, *Response, error) { func (s *IssueService) GetWatchers(issueID string) (*[]User, *Response, error) {
watchesApiEndPoint := fmt.Sprintf("rest/api/2/issue/%s/watchers", issueID) watchesAPIEndpoint := fmt.Sprintf("rest/api/2/issue/%s/watchers", issueID)
req, err := s.client.NewRequest("GET", watchesApiEndPoint, nil) req, err := s.client.NewRequest("GET", watchesAPIEndpoint, nil)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
@ -1056,7 +1057,7 @@ func (s *IssueService) GetWatchers(issueID string) (*[]User, *Response, error) {
return &result, resp, nil return &result, resp, nil
} }
// SetWatcher adds watcher to the given issue // AddWatcher adds watcher to the given issue
// //
// JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-addWatcher // JIRA API docs: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-addWatcher
func (s *IssueService) AddWatcher(issueID string, userName string) (*Response, error) { func (s *IssueService) AddWatcher(issueID string, userName string) (*Response, error) {

View File

@ -112,11 +112,11 @@ func TestIssueService_UpdateIssue(t *testing.T) {
w.WriteHeader(http.StatusNoContent) w.WriteHeader(http.StatusNoContent)
}) })
jId := "PROJ-9001" jID := "PROJ-9001"
i := make(map[string]interface{}) i := make(map[string]interface{})
fields := make(map[string]interface{}) fields := make(map[string]interface{})
i["fields"] = fields i["fields"] = fields
resp, err := testClient.Issue.UpdateIssue(jId, i) resp, err := testClient.Issue.UpdateIssue(jID, i)
if resp == nil { if resp == nil {
t.Error("Expected resp. resp is nil") t.Error("Expected resp. resp is nil")
} }

View File

@ -16,7 +16,7 @@ type CreateMetaInfo struct {
// MetaProject is the meta information about a project returned from createmeta api // MetaProject is the meta information about a project returned from createmeta api
type MetaProject struct { type MetaProject struct {
Expand string `json:"expand,omitempty"` Expand string `json:"expand,omitempty"`
Self string `json:"self, omitempty"` Self string `json:"self,omitempty"`
Id string `json:"id,omitempty"` Id string `json:"id,omitempty"`
Key string `json:"key,omitempty"` Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`

View File

@ -79,7 +79,7 @@ func (s *ProjectService) GetList() (*ProjectList, *Response, error) {
return s.ListWithOptions(&GetQueryOptions{}) return s.ListWithOptions(&GetQueryOptions{})
} }
// GetList gets all projects form JIRA with optional query params, like &GetQueryOptions{Expand: "issueTypes"} to get // ListWithOptions gets all projects form JIRA with optional query params, like &GetQueryOptions{Expand: "issueTypes"} to get
// a list of all projects and their supported issuetypes // a list of all projects and their supported issuetypes
// //
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getAllProjects // JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getAllProjects

View File

@ -99,7 +99,7 @@ func (s *UserService) GetGroups(username string) (*[]UserGroup, *Response, error
return userGroups, resp, nil return userGroups, resp, nil
} }
// Finds user info from JIRA: // Find searches for user info from JIRA:
// It can find users by email, username or name // It can find users by email, username or name
// //
// JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user-findUsers // JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/user-findUsers