Which Unix/derivative? The great thing about them is that they have so many 
standards to choose from ;)

"go build" isn't sufficient for most of my projects, if I want proper 
distribution of binaries. I might use "go generate" to create some 
data/source a program depends on, and I always embed the version tag as 
returned by "git describe --tags <branch> --abbrev=0"  in the binaries with 
the -X flag. That requires a build script of some sort.

If you package with any common Linux distro's tools it's expected that the 
packager has a full build environment. It would of course be useful if you 
included a script to "go get" everything the build needs, and that can 
usually be done in pre-build hooks in these packaging systems.

If you're building server apps maybe you'd consider packaging as containers 
instead. If they're command line tools you're still going to have to 
consider the target OS and its conventions, but you can make the binary 
quite self-sufficient with per-platform source files or/and go generated 
settings, so that they look for or create a configuration file.

I don't think the packaging itself is a problem, as there are tools like 
dh-make-golang to massage Go into Debian-derivative packages. You just need 
to specify and dependencies like databases, discovery services and so on 
you require.

For my own stuff I make the programs themselves flexible enough that there 
aren't any hard requirements for configuration files and their locations, 
but Linux builds have a fallback to /etc/<appname>/ for server stuff, 
$HOME/.<appname>/ for CLI tools, and macOS builds use 
$HOME/Library/Application Support/<appname>/. I always leave in the option 
to specify an alternative path via -C or --config.

The config files define where to load all the other data and any logging 
options (/var/ and /log/ are possibilities there).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to