-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
78 lines (64 loc) · 1.38 KB
/
config.go
File metadata and controls
78 lines (64 loc) · 1.38 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main
import "runtime"
const (
defaultMinVersion = "1.0.0"
defaultGoBuildOutputFolder = ".gobuild"
defaultGoBuildConfig = ".gobuild-config"
defaultGoBuildVersionFile = ".gobuild-version"
defaultGoBuildBinaryFile = ".gobuild-binary"
)
var (
version = "1.0.1"
// go tool dist list
// https://go.dev/wiki/GoArm
defaultPlatforms = []string{
"linux/amd64",
"linux/arm/5",
"linux/arm/6",
"linux/arm/7",
"linux/arm64",
"darwin/amd64",
"darwin/arm64",
"windows/386",
"windows/amd64",
"windows/arm64",
}
defaultEnvs = map[string]string{
"CGO_ENABLED": "0",
"GO111MODULE": "on",
}
osToDisplay = map[string]string{
"darwin": "osx",
}
osToExt = map[string]string{
"windows": ".exe",
}
archToDisplay = map[string]string{
"386": "x86",
"amd64": "x86_64",
"arm64": "aarch64",
}
)
type Config struct {
Compress bool `json:"compress,omitempty"`
Compressor string `json:"compressor,omitempty"`
CompressorFlags []string `json:"compressorFlags,omitempty"`
Platforms []string `json:"platforms,omitempty"`
}
func NewConfig() Config {
config := Config{
Compress: true,
Compressor: "upx",
Platforms: defaultPlatforms,
}
if runtime.GOOS == "windows" {
config.Compressor += ".exe"
}
return config
}
type BuildConfig struct {
Binary string
Config Config
Version string
GoModFolder string
}