Hi,
I'm trying to build with bazel the otel collector binary using the otel collector builder
by default the builder does the following but stages can be skipped
1. generates some go source code (and a go.mod) based on a config file
2. runs go get
3. runs go build
My initial approach was to have the builder only generate the source code, then pass the generating target to the srcs attribute of a go_binary.
To do this I had been using ctx.actions.declare_directory, putting the source files underneath and returning it in the rules DefaultInfo.
Unfortunately this fails with "unknown source type". It works as expected if I replace the directory with explicit calls to declare_file(foo.go) but obviously thats not a good long term option.
Is it possible to do what I'm trying with declare_directory or is there better approach? The other idea I had was to create the environment the builder expects (GOPATH etc) and have it run go build itself, this works up until I need to symlink the deps eg com_github_foo_bar into gopath/src/
github.com/foo/bar
Thanks,
Tom