mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-15 21:45:35 +08:00
Many places have the following logic:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
ids := make(container.Set[int64], len(jobs))
for _, j := range jobs {
if j.RunID == 0 {
continue
}
ids.Add(j.RunID)
}
return ids.Values()
}
```
this introduces a `container.FilterMapUnique` function, which reduces
the code above to:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
return container.FilterMapUnique(jobs, func(j *ActionRunJob) (int64, bool) {
return j.RunID, j.RunID != 0
})
}
```
|
||
|---|---|---|
| .. | ||
| action_list.go | ||
| action_test.go | ||
| action.go | ||
| main_test.go | ||
| notification_list.go | ||
| notification_test.go | ||
| notification.go | ||
| repo_activity.go | ||
| statistic.go | ||
| user_heatmap_test.go | ||
| user_heatmap.go | ||