Skip to content

Commit

Permalink
internal/gitlab: unexport JobSorter type
Browse files Browse the repository at this point in the history
There isn't a reason for letting JobSorter exported considering it's
used only internally in the gitlab.go file.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
  • Loading branch information
bmeneg committed Jun 23, 2021
1 parent 88ada3d commit fe9248b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -1177,11 +1177,11 @@ type JobStruct struct {
// A project ID can either be a string or an integer
ProjectID interface{}
}
type JobSorter struct{ Jobs []JobStruct }
type jobSorter struct{ Jobs []JobStruct }

func (s JobSorter) Len() int { return len(s.Jobs) }
func (s JobSorter) Swap(i, j int) { s.Jobs[i], s.Jobs[j] = s.Jobs[j], s.Jobs[i] }
func (s JobSorter) Less(i, j int) bool {
func (s jobSorter) Len() int { return len(s.Jobs) }
func (s jobSorter) Swap(i, j int) { s.Jobs[i], s.Jobs[j] = s.Jobs[j], s.Jobs[i] }
func (s jobSorter) Less(i, j int) bool {
return time.Time(*s.Jobs[i].Job.CreatedAt).Before(time.Time(*s.Jobs[j].Job.CreatedAt))
}

Expand Down Expand Up @@ -1313,7 +1313,7 @@ func CIJobs(pid interface{}, id int, followBridge bool) ([]JobStruct, error) {

// ListPipelineJobs returns jobs sorted by ID in descending order,
// while we want them to be ordered chronologically
sort.Sort(JobSorter{list})
sort.Sort(jobSorter{list})

return list, nil
}
Expand Down

0 comments on commit fe9248b

Please sign in to comment.