From 0f1cc7f352069dceeb464da782f2e117e476194e Mon Sep 17 00:00:00 2001 From: Mmx233 Date: Sun, 18 Sep 2022 15:22:59 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BC=98=E5=8C=96=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9f52906..28a1017 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,15 @@ docker build . --file Dockerfile --tag mmx233/bitsrunlogin-go:latest 直接编译本系统可执行程序: ```shell -go build -ldflags "-s -w -extldflags '-static'" +git clone https://github.com/Mmx233/BitSrunLoginGo.git +cd BitSrunLoginGo +go build +``` + +或者使用经过优化的构建命令: + +```shell +go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-s -w -extldflags '-static'" ``` 交叉编译(Linux): @@ -100,7 +108,7 @@ go build -ldflags "-s -w -extldflags '-static'" export GOGGC=0 export GOOS=windows #系统 export GOARCH=amd64 #架构 -go build -ldflags "-s -w -extldflags '-static'" +go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-s -w -extldflags '-static'" ``` 交叉编译(Powershell): @@ -109,7 +117,7 @@ go build -ldflags "-s -w -extldflags '-static'" $env:GOGGC=0 $env:GOOS='linux' #系统 $env:GOARCH='amd64' #架构 -go build -ldflags "-s -w -extldflags '-static'" +go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-s -w -extldflags '-static'" ``` golang 支持的系统与架构请自行查询