How to build multiple binaries, with multiple and differents go files #1531
Replies: 3 comments 7 replies
-
I think you can just put both files on the The environment setup you should probably make configurable, as you're probably embedding database secrets in your binaries. https://github.com/caarlos0/env might help you make that easy :) |
Beta Was this translation helpful? Give feedback.
-
Hi @caarlos0, I've write some lines to test: https://github.com/sebbbastien/goProgram In From the command line I can have:
I've try multiple way to compile this with goreleaser. From the "root" folder:
The output is:
I tried two other solutions, another from "root" directory:
The output is:
And a last from the subfolder/
The output is:
Do you see another way to do that with goreleaser? |
Beta Was this translation helpful? Give feedback.
-
How to build multiple binaries with the same |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have to build two binaries, one produce data and store them in a database, the other consume data from the database. These two binaries share the connection information to the database, and they must be standalone files, I can't use a side config file (json/ini, etc.) to store database credentials.
I need to provide this pair of binaries for multiple clients, so they must not use the same database IP/login/password information.
I have two main files, mainProducer.go and mainConsumer.go. They declare main package and main().
Alongside I have one Go file for each customer, envA.go, envB.go, etc, each file set a database connection struct, with the same fields, but differents values.
Without goreleaser I can run
go build mainProducer.go envA.go
andgo build mainConsumer.go envA.go
to build binaries for customer A.I haven't figured out how to build two binaries with Goreleaser.
Do you see a solution using Goreleaser?
Best regards,
Beta Was this translation helpful? Give feedback.
All reactions