-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Summary
Currently vgopath does not populate the src folder in the virtual GOPATH directory, if the project contains a vendor folder.
It would be nice if the src directory is populated even in that case so that vgopath can be used from projects that still have not gotten rid of the vendor dir.
Motivation
We use vgopath in https://github.com/gardener/gardener for code generation, for example in generate-crds.sh which calls vgopath-setup.sh.
This script can be invoked from other go projects which import gardener/gardener as a go module. E.g. to generate example crds in https://github.com/gardener/gardener-extension-provider-aws/.
If a newer version of gardener/gardener is vendored in https://github.com/gardener/gardener-extension-provider-aws/ and generate-crds.sh which uses vgopath is called, e.g. as part of make generate, the following error would occur:
cannot find package "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" in any of:
/usr/local/go/src/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1 (from $GOROOT)
/var/folders/75/_pj1jwmn1kd6scf_svk9jw2h0000gn/T/tmp.SKD3gsDVMf/src/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1 (from $GOPATH)
This happens because the src folder in the temp directory created for the virtual GOPATH is empty and the generate-crds.sh script sets GO111MODULE to off here: https://github.com/gardener/gardener/blob/cdad185a27b39b2f35b8ae4d921273d65ae164ae/hack/generate-crds.sh#L48
We have a bunch more similar projects that vendor gardener/gardener and use generate-crds.sh for which we might not be able to remove the vendor folder very soon.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status