Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-5704

controller-gen doesn't work after disabling api module

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Critical Critical
    • None
    • 1.9.1.Final
    • Operator
    • None
    • False
    • False
    • undefined

      When running make run on a clean main branch, I'm getting the following error:

      /home/kevin/go/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
      go mod tidy
      ./hack/kogito-module-api.sh --disable
      /home/kevin/go/bin/controller-gen "crd:crdVersions=v1" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
      go: github.com/kiegroup/kogito-operator/api@v0.0.0-00010101000000-000000000000 (replaced by ./api): reading api/go.mod: open /home/kevin/go/src/github.com/kiegroup/kogito-operator/api/go.mod: no such file or directory
      make: *** [Makefile:74: fmt] Error 1
      make: *** Waiting for unfinished jobs....
      ./hack/kogito-module-api.sh --enable
      ./hack/openapi.sh
      Generating openapi files
      go: found github.com/kiegroup/kogito-operator/api in github.com/kiegroup/kogito-operator/api v0.0.0-00010101000000-000000000000
      go: found github.com/kiegroup/kogito-operator/api/v1beta1 in github.com/kiegroup/kogito-operator/api v0.0.0-00010101000000-000000000000
      2021/08/12 12:38:03 OpenAPI code generation error: Failed making a parser: unable to add directory "github.com/kiegroup/kogito-operator/api/v1beta1": unable to import "github.com/kiegroup/kogito-operator/api/v1beta1": module github.com/kiegroup/kogito-operator/api provides package github.com/kiegroup/kogito-operator/api/v1beta1 and is replaced but not required; to add it:
      	go get github.com/kiegroup/kogito-operator/api
      make: **\* [Makefile:84: generate] Error 1
      

      This seems strange as ./hack/kogito-module-api.sh --disable should disable the api module, but controller-gen still seems to be looking for it?

      Also talking to amadhusu about this issue, he suggested downgrading my Go version as this helped fix a similar issue for him. This was suggested to him by vajain. I tried Go versions 1.15.15 and 1.16.[4|6|7] all with no luck in fixing this issue. I also ran git reset --hard between each try.

              vajain Vaibhav Jain
              kevin-mok Kevin Mok (Inactive)
              Karel Suta Karel Suta
              Karel Suta Karel Suta
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: