Using binary packages directly

后端 未结 4 1307
情深已故
情深已故 2020-12-08 11:22

I\'m writing a library in Go. I\'m planning to distribute it, and with a main requirement of \'without source codes\'.

For testing, I have created

4条回答
  •  再見小時候
    2020-12-08 12:01

    The Go compiler just needs the .a files. If you ship them anybody will be able to use your package without the source code.

    BUT your users will have to invoke the compiler (e.g. 6g, not the go tool) manually. If you ship a myfoo.a file and a dummy source myfoo.go containing just package myfoo and the timestamp of myfoo.a is newer than that of myfoo.go (and you put everything in place) you may use the go tool.

    Update: Newer version of the go tool detect deleted files and require all files (possibly empty) with the proper filenames and older timestamps in the src folder. Managing a timestamp should not be a dealbreaker.

    Don't get fooled that the go tool is Go: It is a dead convenient tool to build, test, get, whatever your Go code, but it is neither the language nor the compiler nor the linker.

    BTW: There is really no point in not distributing the sources.

提交回复
热议问题