@@ -32,16 +32,31 @@ import (
32
32
"github.com/rs/zerolog/log"
33
33
)
34
34
35
+ // BuildProvChecker builds myst binary with provider checker API. Like go tool, it supports cross-platform build with env vars: GOOS, GOARCH.
36
+ func BuildProvChecker () error {
37
+ logconfig .Bootstrap ()
38
+ if err := buildBinary (path .Join ("cmd" , "mysterium_node" , "mysterium_node.go" ), "myst" , true ); err != nil {
39
+ return err
40
+ }
41
+ if err := copyConfig ("myst" ); err != nil {
42
+ return err
43
+ }
44
+ if err := buildBinary (path .Join ("cmd" , "supervisor" , "supervisor.go" ), "myst_supervisor" , false ); err != nil {
45
+ return err
46
+ }
47
+ return nil
48
+ }
49
+
35
50
// Build builds the project. Like go tool, it supports cross-platform build with env vars: GOOS, GOARCH.
36
51
func Build () error {
37
52
logconfig .Bootstrap ()
38
- if err := buildBinary (path .Join ("cmd" , "mysterium_node" , "mysterium_node.go" ), "myst" ); err != nil {
53
+ if err := buildBinary (path .Join ("cmd" , "mysterium_node" , "mysterium_node.go" ), "myst" , false ); err != nil {
39
54
return err
40
55
}
41
56
if err := copyConfig ("myst" ); err != nil {
42
57
return err
43
58
}
44
- if err := buildBinary (path .Join ("cmd" , "supervisor" , "supervisor.go" ), "myst_supervisor" ); err != nil {
59
+ if err := buildBinary (path .Join ("cmd" , "supervisor" , "supervisor.go" ), "myst_supervisor" , false ); err != nil {
45
60
return err
46
61
}
47
62
return nil
@@ -67,7 +82,7 @@ func buildCrossBinary(os, arch string) error {
67
82
return sh .Run ("bin/build_xgo" , os + "/" + arch )
68
83
}
69
84
70
- func buildBinary (source , target string ) error {
85
+ func buildBinary (source , target string , provChecker bool ) error {
71
86
targetOS , ok := os .LookupEnv ("GOOS" )
72
87
if ! ok {
73
88
targetOS = runtime .GOOS
@@ -76,10 +91,10 @@ func buildBinary(source, target string) error {
76
91
if ! ok {
77
92
targetArch = runtime .GOARCH
78
93
}
79
- return buildBinaryFor (source , target , targetOS , targetArch , nil , false )
94
+ return buildBinaryFor (source , target , targetOS , targetArch , nil , false , provChecker )
80
95
}
81
96
82
- func buildBinaryFor (source , target , targetOS , targetArch string , extraEnvs map [string ]string , buildStatic bool ) error {
97
+ func buildBinaryFor (source , target , targetOS , targetArch string , extraEnvs map [string ]string , buildStatic , provChecker bool ) error {
83
98
log .Info ().Msgf ("Building %s -> %s %s/%s" , source , target , targetOS , targetArch )
84
99
85
100
buildDir , err := filepath .Abs (path .Join ("build" , target ))
@@ -100,6 +115,9 @@ func buildBinaryFor(source, target, targetOS, targetArch string, extraEnvs map[s
100
115
if buildStatic {
101
116
flags = append (flags , "-a" , "-tags" , "netgo" )
102
117
}
118
+ if provChecker {
119
+ flags = append (flags , "-tags" , "prov_checker" )
120
+ }
103
121
104
122
if targetOS == "windows" {
105
123
target += ".exe"
0 commit comments