Golang使用主程序包代码和.a文件进行编译吗?

In my scenario I'll need to release my lib project without source code but a compiled form. Given,

  • Some library package in the form of compiled .a files,
  • a main package in form of source code,
  • all their platform types where they're built on match,

is it possible to compile the main and link it with .a files up into an executable? How to do it if doable?

Not unless the .a files were generated as a result of "installing" (go get or go install) a package. A ".a" library file is "customized" for the OS, machine architecture, go version etc. of the environment in which it will be used. Users of your library are not likely to meet all of the requirements. For that reason, and perhaps others, ".a" files without source code are not useful.