build icon indicating copy to clipboard operation
build copied to clipboard

`make generate` doesn't work outside of $GOPATH

Open imjasonh opened this issue 3 years ago • 1 comments

The repo uses Go modules, which means you don't have to have the codebase checked out into $GOPATH to build it. Unfortunately, it looks like make generate doesn't work unless you're in $GOPATH, it fails somewhere in fake generation:

$ make generate
hack/update-codegen.sh

Using code-generator package version, as instructed in the go.mod file
The code-generator package is imported via the pkg/kubecodegen dir
To modify the current version, please modify this in the go.mod

Generating deepcopy funcs
Generating clientset for build:v1alpha1 at github.com/shipwright-io/build/pkg/client/clientset
Generating listers for build:v1alpha1 at github.com/shipwright-io/build/pkg/client/listers
Generating informers for build:v1alpha1 at github.com/shipwright-io/build/pkg/client/informers
hack/generate-fakes.sh
Writing `FakeManager` to `pkg/controller/fakes/manager.go`... 
-: import "/Users/jasonhall/git/build/vendor/sigs.k8s.io/controller-runtime/pkg/manager": cannot import absolute path

To repro, check out the repo outside of $GOPATH:

cd $TEMPDIR
git clone https://github.com/shipwright-io/build && cd build
go build ./...  # works
make generate   # fails

imjasonh avatar Mar 18 '21 14:03 imjasonh