Skip to content

Commit

Permalink
internal/gitlab/gitlab.go: Update for new version of gitlab library
Browse files Browse the repository at this point in the history
Fix some compilation issues introduced by the new gitlab library version.

Signed-off-by: Prarit Bhargava <[email protected]>
  • Loading branch information
prarit committed Jan 18, 2024
1 parent 6b759b6 commit ea35870
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions internal/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ func LabelCreate(projID interface{}, opts *gitlab.CreateLabelOptions) error {

// LabelDelete removes a project label
func LabelDelete(projID, name string) error {
_, err := lab.Labels.DeleteLabel(projID, &gitlab.DeleteLabelOptions{
_, err := lab.Labels.DeleteLabel(projID, name, &gitlab.DeleteLabelOptions{
Name: &name,
})
return err
Expand Down Expand Up @@ -1689,7 +1689,9 @@ func TodoIssueCreate(projID interface{}, id int) (int, error) {
func GetCommitDiff(projID interface{}, sha string) ([]*gitlab.Diff, error) {
var diffs []*gitlab.Diff
opt := &gitlab.GetCommitDiffOptions{
PerPage: maxItemsPerPage,
ListOptions: gitlab.ListOptions{
PerPage: maxItemsPerPage,
},
}

for {
Expand Down Expand Up @@ -1810,23 +1812,25 @@ func CreateMergeRequestCommitDiscussion(projID interface{}, id int, sha string,
return "", err
}

position := gitlab.NotePosition{
NewPath: newFile,
OldPath: oldFile,
BaseSHA: commitInfo.ParentIDs[0],
StartSHA: commitInfo.ParentIDs[0],
HeadSHA: sha,
PositionType: "text",
positionType := "text"

position := gitlab.PositionOptions{
NewPath: &newFile,
OldPath: &oldFile,
BaseSHA: &commitInfo.ParentIDs[0],
StartSHA: &commitInfo.ParentIDs[0],
HeadSHA: &sha,
PositionType: &positionType,
}

switch linetype {
case "new":
position.NewLine = line
position.NewLine = &line
case "old":
position.OldLine = line
position.OldLine = &line
case "context":
position.NewLine = line
position.OldLine = line
position.NewLine = &line
position.OldLine = &line
}

opt := &gitlab.CreateMergeRequestDiscussionOptions{
Expand Down

0 comments on commit ea35870

Please sign in to comment.