go tool pack

该命令把二进制文件打包成静态库。

go tool pack op file.a [name...]

参数op
    c   append files (from the file system) to a new archive
    p   print files from the archive
    r   append files (from the file system) to the archive
    t   list files from the archive
    x   extract files from the archive

go tool compile -o simplemath.o src/simplemath/add.go src/simplemath/sqrt.go
go tool pack c pkg/linux_amd64/simplemath.a simplemath.o

参考:

http://cache.baiducontent.com/

最后编辑: kuteng  文档更新时间: 2022-07-29 14:34   作者:kuteng