Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are golang projects packaged for deployment?

Tags:

go

Coming from a JVM background I would like to know how to deploy a golang project to production. Is there an equivalent of a JAR file?

Is there a standalone package manager that can be installed on server and a dependency manifest file which can be run to bring down all dependencies on the server. I specifically do not want to have to build the project on the server as we can't have any compilers etc on production boxes.

thanks.

like image 506
Zuriar Avatar asked May 18 '15 17:05

Zuriar


Video Answer


1 Answers

I you run go install <pkg>, the binary will be placed in $GOPATH/bin. You can copy that binary to another machine that has the same OS and architecture.

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

There are no dependencies in a Go binary for you to track. It is statically linked. (Some system libraries may be dynamically linked, but if you are running on the same OS, this shouldn't be a problem.)

like image 104
Rob Napier Avatar answered Nov 14 '22 21:11

Rob Napier