golang-container icon indicating copy to clipboard operation
golang-container copied to clipboard

Support for non-standard go build path

Open lance opened this issue 1 year ago • 0 comments

Hello, we would like to use the s2i golang library to build Go functions in Knative Functions. The function project looks like this:

❯ tree .
.
├── README.md
├── faas
│   └── main.go
├── func.yaml
├── go.mod
├── go.sum
├── handle.go
└── handle_test.go

As you can see, the main.go file is in the faas subdirectory. However, with the golang s2i builder image, there is no way to specify this in the command. A similar feature exists, for example, in paketo buildpacks, allowing developers to set the environment variable BP_GO_TARGETS, resulting in a build command that looks like this:

go build -o /layers/paketo-buildpacks_go-build/targets/bin -buildmode pie -trimpath ./faas

Could something similar be added to the golang s2i builder to enable this functionality?

lance avatar Dec 02 '22 18:12 lance