Chore: Disable cgo by default for local builds (#111807)
* disable cgo by default for local builds, also set cgo variable in either case * actually do not set the default value * disable cgo for darwin, display sqlite driver in logs * fix linter warning, although I do not fully agree with it
This commit is contained in:
+9
-5
@@ -18,6 +18,7 @@ import (
|
||||
const (
|
||||
GoOSWindows = "windows"
|
||||
GoOSLinux = "linux"
|
||||
GoOSDarwin = "darwin"
|
||||
|
||||
BackendBinary = "grafana"
|
||||
ServerBinary = "grafana-server"
|
||||
@@ -288,8 +289,9 @@ func setBuildEnv(opts BuildOpts) error {
|
||||
}
|
||||
}
|
||||
|
||||
if opts.goarch != "amd64" || opts.goos != GoOSLinux {
|
||||
// needed for all other archs
|
||||
if (opts.goos != GoOSLinux || opts.goarch != "amd64") &&
|
||||
opts.goos != GoOSDarwin {
|
||||
// needed for archs other than linux/amd64 and darwin/arm64 + darwin/amd64
|
||||
opts.cgo = true
|
||||
}
|
||||
|
||||
@@ -307,10 +309,12 @@ func setBuildEnv(opts BuildOpts) error {
|
||||
}
|
||||
}
|
||||
|
||||
cgoEnabled := "0"
|
||||
if opts.cgo {
|
||||
if err := os.Setenv("CGO_ENABLED", "1"); err != nil {
|
||||
return err
|
||||
}
|
||||
cgoEnabled = "1"
|
||||
}
|
||||
if err := os.Setenv("CGO_ENABLED", cgoEnabled); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if opts.gocc == "" {
|
||||
|
||||
Reference in New Issue
Block a user