Basically my folder structure is as below:
bin/
pkg/
linux_amd64/
github.com/user/
stringutil.a
src/
github.com/user/
hello/
hello.go (main file)
stringutil/
stringutil.go
hello.go
is the main program that imports some function from stringutil.go
.
After running go install
, stringutil.a
is created under pkg
(as above).
My question is, can I run go install
again without stringutil.go
source since I already have stringutil.a
?
I'm a Java programmer and new to Go. Usually in Java, during compilation, we can import the compiled jar file to the classpath and do compilation.
How can I do the same thing in Go? If I have a compiled package, stringutil.a
, how can I distribute this file to someone and let them use it without exposing the original source code?