summaryrefslogtreecommitdiff
path: root/xmake/toolchains/go/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-05 22:38:22 +0800
committerruki <[email protected]>2025-12-05 22:38:22 +0800
commitb25ae9c831a536b17a913b7af2494f08c9c98c4d (patch)
tree8aef67d1fc1b975a7e3bff048fd2848410050e8c /xmake/toolchains/go/xmake.lua
parente688a7bd853c49ec10aa8656e704c2115ea5e14c (diff)
format code
Diffstat (limited to 'xmake/toolchains/go/xmake.lua')
-rw-r--r--xmake/toolchains/go/xmake.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/xmake/toolchains/go/xmake.lua b/xmake/toolchains/go/xmake.lua
index d12fe0dc2..d7ae96f8c 100644
--- a/xmake/toolchains/go/xmake.lua
+++ b/xmake/toolchains/go/xmake.lua
@@ -34,30 +34,30 @@ toolchain("go")
-- on load
on_load(function (toolchain)
import("private.tools.go.goenv")
-
+
-- set GOOS and GOARCH for cross-compilation
local goos = goenv.GOOS(toolchain:plat())
if goos then
toolchain:add("runenvs", "GOOS", goos)
end
-
+
local goarch = goenv.GOARCH(toolchain:arch())
if goarch then
toolchain:add("runenvs", "GOARCH", goarch)
end
-
+
-- Set CGO_ENABLED=0 by default for better cross-compilation support
-- Users can override this if they need CGO
if not os.getenv("CGO_ENABLED") then
toolchain:add("runenvs", "CGO_ENABLED", "0")
end
-
+
-- Disable Go modules mode to use GOPATH mode
-- This allows Go to find packages using GOPATH
if not os.getenv("GO111MODULE") then
toolchain:add("runenvs", "GO111MODULE", "off")
end
-
+
-- Set GOPATH to project directory if not already set
-- This allows Go to find packages in the project
if not os.getenv("GOPATH") then
@@ -66,7 +66,7 @@ toolchain("go")
toolchain:add("runenvs", "GOPATH", projectdir)
end
end
-
+
-- set default flags
toolchain:set("gcldflags", "")
toolchain:set("gcarflags", "")