Closed
Description
With a project/function having a go.mod specifying go-1.23, a vendor directory with private dependencies, and trying to build with pack build --builder gcr.io/buildpacks/builder:latest
(as per the readme instructions), I get the following error:
[builder] Running "go build -o /layers/google.go.build/bin/main functions.local/app (GOCACHE=/layers/google.go.build/gocache)"
[builder] go: ignoring package functions.local/app which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
[builder] cannot find module providing package functions.local/app: import lookup disabled by -mod=vendor
[builder] (Go version in go.mod is at least 1.14 and vendor directory exists.)
[builder] Done "go build -o /layers/google.go.build/bin/main functions.local..." (56.742292ms)
[builder] Tip: "GOOGLE_BUILDABLE" env var configures which Go package is built. Default is '.'
This error does not occur with a go.mod specifying go-1.22.
I believe the issue stems from this change in go-1.23 here: https://github.com/golang/go/blob/master/src/cmd/go/internal/modload/import.go#L344-L346