Skip to content

golang: Allow users to specify desired buildflags

Kirill Smelkov requested to merge kirr/slapos:y/go-buildmode into master

For example one could want to build the software with race detector, e.g.

[gowork]
...
buildflags = -race

or if you want to build a plugin for fluent-bit

[gowork]
...
install	   = your.package.import.path
buildflags = -buildmode=c-shared

and then your package will be installed as shared library into

${gowork:directory}/pkg/`go env GOOS`_`go env GOARCH`/<your.package.import.path>.a

One could pass that location explicitly to fluentd-bit -e ... or symlink to it from some .so from global directory of fluent-bit plugins.

Maybe it is not very good to use go install for building plugins (instead of go build -o ...) but we anyway need to have ability to specify buildflags as a generic feature, hence this patch.

Merge request reports