Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate src folder in virtual GOPATH even if project still uses a vendor folder #12

Open
plkokanov opened this issue Dec 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@plkokanov
Copy link

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.

@plkokanov plkokanov added the enhancement New feature or request label Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant