From d2bd8916a77651cbf47439c01ef03d70a53e4956 Mon Sep 17 00:00:00 2001 From: "f.eremeev" Date: Tue, 31 May 2022 13:06:45 +0300 Subject: [PATCH 1/2] [ISSUE-113] fixed gitlab urls --- notifier/gitlab/gitlab.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/notifier/gitlab/gitlab.go b/notifier/gitlab/gitlab.go index 33b7add..606435a 100644 --- a/notifier/gitlab/gitlab.go +++ b/notifier/gitlab/gitlab.go @@ -23,25 +23,25 @@ type GitLab struct { // CreateMergeRequestNote is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.CreateMergeRequestNote func (g *GitLab) CreateMergeRequestNote(mergeRequest int, opt *gitlab.CreateMergeRequestNoteOptions, options ...gitlab.OptionFunc) (*gitlab.Note, *gitlab.Response, error) { - return g.Client.Notes.CreateMergeRequestNote(fmt.Sprintf("%s/%s", g.namespace, g.project), mergeRequest, opt, options...) + return g.Client.Notes.CreateMergeRequestNote(fmt.Sprintf("%s", g.project), mergeRequest, opt, options...) } // DeleteMergeRequestNote is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.DeleteMergeRequestNote func (g *GitLab) DeleteMergeRequestNote(mergeRequest, note int, options ...gitlab.OptionFunc) (*gitlab.Response, error) { - return g.Client.Notes.DeleteMergeRequestNote(fmt.Sprintf("%s/%s", g.namespace, g.project), mergeRequest, note, options...) + return g.Client.Notes.DeleteMergeRequestNote(fmt.Sprintf("%s", g.project), mergeRequest, note, options...) } // ListMergeRequestNotes is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.ListMergeRequestNotes func (g *GitLab) ListMergeRequestNotes(mergeRequest int, opt *gitlab.ListMergeRequestNotesOptions, options ...gitlab.OptionFunc) ([]*gitlab.Note, *gitlab.Response, error) { - return g.Client.Notes.ListMergeRequestNotes(fmt.Sprintf("%s/%s", g.namespace, g.project), mergeRequest, opt, options...) + return g.Client.Notes.ListMergeRequestNotes(fmt.Sprintf("%s", g.project), mergeRequest, opt, options...) } // PostCommitComment is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#CommitsService.PostCommitComment func (g *GitLab) PostCommitComment(sha string, opt *gitlab.PostCommitCommentOptions, options ...gitlab.OptionFunc) (*gitlab.CommitComment, *gitlab.Response, error) { - return g.Client.Commits.PostCommitComment(fmt.Sprintf("%s/%s", g.namespace, g.project), sha, opt, options...) + return g.Client.Commits.PostCommitComment(fmt.Sprintf("%s", g.project), sha, opt, options...) } // ListCommits is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#CommitsService.ListCommits func (g *GitLab) ListCommits(opt *gitlab.ListCommitsOptions, options ...gitlab.OptionFunc) ([]*gitlab.Commit, *gitlab.Response, error) { - return g.Client.Commits.ListCommits(fmt.Sprintf("%s/%s", g.namespace, g.project), opt, options...) + return g.Client.Commits.ListCommits(fmt.Sprintf("%s", g.project), opt, options...) } From f1b592180bfe153c18a00e41dcaa140a50bd019a Mon Sep 17 00:00:00 2001 From: "f.eremeev" Date: Thu, 16 Jun 2022 14:40:16 +0300 Subject: [PATCH 2/2] [ISSUE-113] fix linter issues --- notifier/gitlab/gitlab.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/notifier/gitlab/gitlab.go b/notifier/gitlab/gitlab.go index 606435a..09201a6 100644 --- a/notifier/gitlab/gitlab.go +++ b/notifier/gitlab/gitlab.go @@ -1,8 +1,6 @@ package gitlab import ( - "fmt" - gitlab "github.com/xanzy/go-gitlab" ) @@ -23,25 +21,25 @@ type GitLab struct { // CreateMergeRequestNote is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.CreateMergeRequestNote func (g *GitLab) CreateMergeRequestNote(mergeRequest int, opt *gitlab.CreateMergeRequestNoteOptions, options ...gitlab.OptionFunc) (*gitlab.Note, *gitlab.Response, error) { - return g.Client.Notes.CreateMergeRequestNote(fmt.Sprintf("%s", g.project), mergeRequest, opt, options...) + return g.Client.Notes.CreateMergeRequestNote(g.project, mergeRequest, opt, options...) } // DeleteMergeRequestNote is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.DeleteMergeRequestNote func (g *GitLab) DeleteMergeRequestNote(mergeRequest, note int, options ...gitlab.OptionFunc) (*gitlab.Response, error) { - return g.Client.Notes.DeleteMergeRequestNote(fmt.Sprintf("%s", g.project), mergeRequest, note, options...) + return g.Client.Notes.DeleteMergeRequestNote(g.project, mergeRequest, note, options...) } // ListMergeRequestNotes is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.ListMergeRequestNotes func (g *GitLab) ListMergeRequestNotes(mergeRequest int, opt *gitlab.ListMergeRequestNotesOptions, options ...gitlab.OptionFunc) ([]*gitlab.Note, *gitlab.Response, error) { - return g.Client.Notes.ListMergeRequestNotes(fmt.Sprintf("%s", g.project), mergeRequest, opt, options...) + return g.Client.Notes.ListMergeRequestNotes(g.project, mergeRequest, opt, options...) } // PostCommitComment is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#CommitsService.PostCommitComment func (g *GitLab) PostCommitComment(sha string, opt *gitlab.PostCommitCommentOptions, options ...gitlab.OptionFunc) (*gitlab.CommitComment, *gitlab.Response, error) { - return g.Client.Commits.PostCommitComment(fmt.Sprintf("%s", g.project), sha, opt, options...) + return g.Client.Commits.PostCommitComment(g.project, sha, opt, options...) } // ListCommits is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#CommitsService.ListCommits func (g *GitLab) ListCommits(opt *gitlab.ListCommitsOptions, options ...gitlab.OptionFunc) ([]*gitlab.Commit, *gitlab.Response, error) { - return g.Client.Commits.ListCommits(fmt.Sprintf("%s", g.project), opt, options...) + return g.Client.Commits.ListCommits(g.project, opt, options...) }