-
Notifications
You must be signed in to change notification settings - Fork 4
/
checks.go
43 lines (37 loc) · 969 Bytes
/
checks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import "fmt"
type checkDetails struct {
reason checkReason
os string
arch string
othersCount int
}
func (cd checkDetails) String() string {
if cd.othersCount > 0 {
if cd.othersCount > 1 {
return fmt.Sprintf("%s on platform %s-%s and %d others", cd.reason, cd.os, cd.arch, cd.othersCount)
}
return fmt.Sprintf("%s on platform %s-%s and one other", cd.reason, cd.os, cd.arch)
}
return fmt.Sprintf("%s on platform %s-%s", cd.reason, cd.os, cd.arch)
}
type checkReason int
const (
reasonUpdate checkReason = iota
reasonBundle
reasonCommand
reasonJar
)
func (cr checkReason) String() string {
switch cr {
case reasonUpdate:
return "URL required for self-update"
case reasonBundle:
return "URL required for bundle-update"
case reasonCommand:
return "URL required for command binary"
case reasonJar:
return "URL required for Java application .jar"
}
panic(fmt.Sprintf("Unknown checkReason %d", cr))
}