()
| 36 | } |
| 37 | |
| 38 | func (ps ProcessSummaries) Sort() { |
| 39 | sort.Slice(ps, func(i int, j int) bool { |
| 40 | var iScore int |
| 41 | var jScore int |
| 42 | |
| 43 | switch ps[i].Type { |
| 44 | case constant.ProcessTypeWeb: |
| 45 | iScore = 0 |
| 46 | default: |
| 47 | iScore = 1 |
| 48 | } |
| 49 | |
| 50 | switch ps[j].Type { |
| 51 | case constant.ProcessTypeWeb: |
| 52 | jScore = 0 |
| 53 | default: |
| 54 | jScore = 1 |
| 55 | } |
| 56 | |
| 57 | if iScore == 1 && jScore == 1 { |
| 58 | return ps[i].Type < ps[j].Type |
| 59 | } |
| 60 | return iScore < jScore |
| 61 | }) |
| 62 | } |
| 63 | |
| 64 | func (ps ProcessSummaries) String() string { |
| 65 | ps.Sort() |
no outgoing calls
no test coverage detected