I've written an application in Go. It has two external dependencies that would need to be met before compiling. In the Go ecosystem, what is the best way to package this app for a simple installation process that includes installing those remote deps? How would a user install my app?
If you have assets that you want to provide alongside the application (a config file, for example) then either: a) package the binary with the assets and tar/zip it up; b) base64 encode the assets and compile them into the binary see here for a good example or c) create a build/install script that does this for the ...
The go run command combines both the compilation and execution of code. This allows to quickly check the output of updated code. go run will NOT create an executable file in our current folder.
If you are expecting a user to compile your application, and that application relies on third party packages or assets, then I'd suggest just cross-compiling for the supported platforms and providing binaries.
If you have assets that you want to provide alongside the application (a config file, for example) then either: a) package the binary with the assets and tar/zip it up; b) base64 encode the assets and compile them into the binary see here for a good example or c) create a build/install script that does this for the user.
If you can clarify your exact requirements it'll be easier to answer more directly.
Go binaries do not have runtime dependencies other than any you might impose in your code. (Its runtime libraries are included in the compiled executable.)
So you would distribute your app the way you would any other statically-linked binary compiled from C, C++ or other code.
On Linux you might create an .rpm or .deb file using the appropriate tooling for that. On Windows you could create an installer using a tool like InnoSetup.
Go produces a single binary. If your external dependencies are compile time dependencies, then your users do not need to worry about them - they're already compiled in.
If they're run time dependencies, then it is a matter of distributing an exe and related resources, which any installer can do for you - whether the exe was written in Go or not is irrelevant. EDIT: If it absolutely must be a single binary even with run time dependencies, then you need to convert your run time dependencies to compile time ones. One method is the one elithrar has suggested.
The only thing you need to worry about from Go's point of view is that you have compiled your code for your user's platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With