Skip to content

Commit 8935382

Browse files
committed
fix: 编译时环境变量错误
1 parent d45d3e3 commit 8935382

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Diff for: build.sh

+9-11
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ export CGO_ENABLED=0
1010
export GO111MODULE=on
1111

1212
build() {
13-
local GOOS=${1:-linux}
14-
local GOARCH=${2:-amd64}
15-
local TARGET=build/${3:-wrest}-$GOOS-$GOARCH
16-
echo building for $GOOS/$GOARCH
17-
go build -ldflags="-s -w" -o $TARGET main.go
18-
if [ x"$GOOS" = x"windows" ]; then
19-
mv $TARGET "${TARGET}.exe"
20-
else
21-
chmod +x $TARGET
13+
local os=${2:-linux}
14+
local arch=${3:-amd64}
15+
local sbin=build/${1:-bin}-$os-$arch
16+
if [ x"$os" = x"windows" ]; then
17+
sbin="${sbin}.exe"
2218
fi
19+
echo building for $os/$arch
20+
GOOS=$os GOARCH=$arch go build -ldflags="-s -w" -o $sbin main.go
2321
}
2422

2523
####################################################################
@@ -48,8 +46,8 @@ if [ -f webview/public/browser/index.html ]; then
4846
cp -av webview/public/browser/. public/
4947
fi
5048

51-
build linux amd64
52-
build windows amd64
49+
build wrest linux amd64
50+
build wrest windows amd64
5351

5452
####################################################################
5553
# package for linux

0 commit comments

Comments
 (0)