/usr/local/go/pkg/tool/darwin_amd64/compile -o $WORK/b001/_pkg_.a -trimpath "$WORK/b001=>" -p main -complete -buildid JqleDuJlC1iLMVADicsQ/JqleDuJlC1iLMVADicsQ -goversion go1.13.6 -D _/Users/jackson/go/src/viper/args -importcfg $WORK/b001/importcfg -pack -c=4 ./main.go ...
mkdir -p $WORK/b001/ cat >$WORK/b001/importcfg << 'EOF' # internal # import config packagefile fmt=/usr/local/go/pkg/darwin_amd64/fmt.a packagefile runtime=/usr/local/go/pkg/darwin_amd64/runtime.a EOF cd /Users/ruby/go/src/hello /usr/local/go/pkg/tool/darwin_amd64/compile -...
I wrote a simple Go program and ran "go run" and "go build", both of which succeeded and produced the expected result. However, I encountered a problem when running "go tool compile -S ./main.go". What did you expect to see?
-gcflags '[pattern=]arg list' 用于指定需要传递给go tool compile命令的参数的列表,更多信息参见(go tool compile) -installsuffix suffix 为了使当前的输出目录与默认的编译输出目录分离,可以使用这个标记.此标记的值会作为结果文件的父目录名称的后缀.其实,如果使用了-race标记,这个标记会被自动追加且其值会为race...
fix update packages to usenewAPIs fmt gofmt(reformat)packagesources generate generate Go files by processing source get add dependencies to current module and install them install compile and install packages and dependencies list list packages or modules ...
generate generate Go files by processing sourcegetadd dependencies to current module and install them install compile and install packages and dependencies list list packages or modules mod module maintenance work workspace maintenance run compile and run Go program ...
Go version 1.21 Output of go env in your module/workspace: GO111MODULE='' GOARCH='arm64' GOBIN='' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOOS='darwin' GOPROXY='https://proxy.golang.org,dire...
.a文件由compile命令生成,也可以通过go tool compile进行调用 .a类型的文件又叫做目标文件(object file),其是一个压缩包,内部包含了_.PKGDEF`、`_go.o两个文件,分别为编译目标文件和链接目标文件 $ file _pkg_.a # 检查文件格式 _pkg_.a: current ar archive # 说明是ar格式的打包文件 ...
这里可以看到创建了两个临时文件夹 b001 和 exe,先执行了 compile 命令,然后 link,生成了归档文件.a 和 最终可执行文件,最终的可执行文件放在 exe 文件夹里面。命令的最后一步就是执行了可执行文件。 总结一下如下图: 举个例子,生成的临时文件可以用go run -work看到,比如当前生成的临时文件夹是如下的路径: ...
go tool compile -S -N -l main.go 第25行代码a.Value = "" "".main.func2 STEXT size=87 args=0x8 locals=0x8 funcid=0x0 0x0000 00000 (main.go:24) TEXT "".main.func2(SB), ABIInternal, $8-8 0x0000 00000 (main.go:24) MOVQ (TLS), CX ...