mirror of
https://github.com/grafana/grafana.git
synced 2025-07-25 16:23:49 +08:00
Fix backend build on Windows (#28557)
* Fix backend build on Windows Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix remaining build.go issues on Windows Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
18
build.go
18
build.go
@ -451,7 +451,12 @@ func gruntBuildArg(task string) []string {
|
||||
}
|
||||
|
||||
func setup() {
|
||||
runPrint("go", "install", "-v", "./pkg/cmd/grafana-server")
|
||||
args := []string{"install", "-v"}
|
||||
if goos == windows {
|
||||
args = append(args, "-buildmode=exe")
|
||||
}
|
||||
args = append(args, "./pkg/cmd/grafana-server")
|
||||
runPrint("go", args...)
|
||||
}
|
||||
|
||||
func printGeneratedVersion() {
|
||||
@ -460,7 +465,12 @@ func printGeneratedVersion() {
|
||||
|
||||
func test(pkg string) {
|
||||
setBuildEnv()
|
||||
runPrint("go", "test", "-short", "-timeout", "60s", pkg)
|
||||
args := []string{"test", "-short", "-timeout", "60s"}
|
||||
if goos == windows {
|
||||
args = append(args, "-buildmode=exe")
|
||||
}
|
||||
args = append(args, pkg)
|
||||
runPrint("go", args...)
|
||||
}
|
||||
|
||||
func doBuild(binaryName, pkg string, tags []string) {
|
||||
@ -482,6 +492,10 @@ func doBuild(binaryName, pkg string, tags []string) {
|
||||
rmr(binary, binary+".md5")
|
||||
}
|
||||
args := []string{"build", "-ldflags", ldflags()}
|
||||
if goos == windows {
|
||||
// Work around a linking error on Windows: "export ordinal too large"
|
||||
args = append(args, "-buildmode=exe")
|
||||
}
|
||||
if len(tags) > 0 {
|
||||
args = append(args, "-tags", strings.Join(tags, ","))
|
||||
}
|
||||
|
Reference in New Issue
Block a user