How are golang projects packaged for deployment?

Based on the background of the JVM, I would like to know how to deploy a golang project for production. Is there a JAR file equivalent?

Is there a separate package manager that can be installed on the server and a dependency manifest file that you can run to bring down all the dependencies on the server. I specifically do not want to create a project on the server, since we cannot have any compilers, etc. On production boxes.

thanks.

+6
source share
1 answer

I ran go install <pkg> , the binary will be placed in $GOPATH/bin . You can copy this binary to another computer with the same OS and architecture.

You can also change the directory containing the main package and just run go build . The binary file will be placed in the current directory.

There are no tracking dependencies in the Go binary. It is statically connected. (Some system libraries may be dynamically linked, but if you are running on the same OS, this should not be a problem.)

+7
source

Source: https://habr.com/ru/post/987432/


All Articles