"mockgen is a program not an importable package" error when converting from Terrajet
- Dominant language
- Go
- Stars
- 481
- Forks
- 131
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 11
Description
### What happened?
Following the migration guide from Terrajet to Upjet, when `make generate` is run the following error occurs:
```
10:07:03 [ OK ] go modules dependencies verified
10:07:03 [ .. ] generating provider schema for Lerentis/gitea 0.12.1
10:07:05 [ OK ] generating provider schema for Lerentis/gitea 0.12.1
10:07:05 [ .. ] go generate linux_amd64
../vendor/github.com/upbound/upjet/pkg/generate.go:25:2: import "github.com/golang/mock/mockgen" is a program, not an importable package
apis/generate.go:33: running "go": exit status 1
```
This was discussed in Slack here: https://crossplane.slack.com/archives/CEG3T90A1/p1670251257226339 and the resolution is to change line 33 in apis/generate.go to:
```go
//go:generate go run ../cmd/generator/main.go ..
```
and then `make generate` will either succeed, or at least fail for known reasons.
### How can we reproduce it?
Follow the migration guide with a project that used Terrajet and has apis/generate.go line 33 set to:
```go
//go:generate go run -tags generate ../cmd/generator/main.go .. "${TERRAFORM_PROVIDER_SOURCE}"
```
It would be helpful to have this change as an explicit step in the migration guide.
Contributor guide
Assessment
This issue has not been assessed yet.