Commit 831271a2 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: Allow users to specify desired buildflags

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.

/reviewed-on !274
parent 254bb43d
......@@ -63,6 +63,11 @@ environment-extra =
# lab.nexedi.com/kirr/neo/go/... \
# github.com/pkg/profile \
# golang.org/x/perf/cmd/benchstat
#
# it is possible to specify Go build flags used for compilation e.g. this way:
#
# [gowork]
# buildflags = -race
[gowork]
directory = ${buildout:directory}/go.work
src = ${:directory}/src
......@@ -72,6 +77,9 @@ depends = ${gowork.goinstall:recipe}
# go version used for the workspace (possible to override in applications)
golang = ${golang19:location}
# no special build flags by default
buildflags =
# everything is done by dependent parts
recipe = plone.recipe.command
command = :
......@@ -100,7 +108,7 @@ stop-on-error = true
# clients should put package list to install to gowork:install ("..." requests installing everything)
[gowork.goinstall]
recipe = plone.recipe.command
command = bash -c ". ${gowork:env.sh} && go install -v ${gowork:install}"
command = bash -c ". ${gowork:env.sh} && go install ${gowork:buildflags} -v ${gowork:install}"
update-command = ${:command}
stop-on-error = true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment