Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Import cycle not allowed #303

Open
Kerwood opened this issue Sep 29, 2022 · 1 comment
Open

Import cycle not allowed #303

Kerwood opened this issue Sep 29, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Kerwood
Copy link

Kerwood commented Sep 29, 2022

What happened?

I am having some "import cycle" issues when running make reviewable on my Terrajet project. Below is three resources that generates the import cycle not allowed error.

  • Team Routing Rule resource references.

    • team_id => type Team
    • notify.id => type Escalation
  • Escalation resource references,

    • owner_team_id => type Team
    • rules.recipient.id => type Team

image

This will generate the following error on running make reviewable.

WARN [runner] Can't run linter goanalysis_metalinter: bodyclose: failed prerequisites: [[email protected]/ok-amba/provider-jet-opsgenie/apis/team/v1alpha1: analysis skipped: errors in package: [/home/kerwood/Git/provider-jet-opsgenie/apis/team/v1alpha1/zz_generated.resolvers.go:23:11: could not import github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1 (-: import cycle not allowed: import stack: [github.com/ok-amba/provider-jet-opsgenie/apis github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1 github.com/ok-amba/provider-jet-opsgenie/apis/team/v1alpha1 github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1])]] 
WARN [runner] Can't run linter unused: buildir: analysis skipped: errors in package: [-: import cycle not allowed: import stack: [github.com/ok-amba/provider-jet-opsgenie/apis github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1 github.com/ok-amba/provider-jet-opsgenie/apis/team/v1alpha1 github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1]] 
ERRO Running error: buildir: analysis skipped: errors in package: [-: import cycle not allowed: import stack: [github.com/ok-amba/provider-jet-opsgenie/apis github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1 github.com/ok-amba/provider-jet-opsgenie/apis/team/v1alpha1 github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1]] 
11:35:52 [FAIL]
make[2]: *** [build/makelib/golang.mk:194: go.lint] Error 1
make[1]: *** [build/makelib/common.mk:357: lint] Error 2
make: *** [build/makelib/common.mk:425: reviewable] Error 2

My guess is that its importing github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1 multiple times for some reason.

[
 github.com/ok-amba/provider-jet-opsgenie/apis 
 github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1 
 github.com/ok-amba/provider-jet-opsgenie/apis/team/v1alpha1 
 github.com/ok-amba/provider-jet-opsgenie/apis/escalation/v1alpha1
]

Links to files

Team Routing Rule config.go file: https://github.com/ok-amba/provider-jet-opsgenie/blob/1d82bf7f2d5477d61db916c4868333187a0b10b1/config/teamroutingrule/config.go
Escalation config.go file: https://github.com/ok-amba/provider-jet-opsgenie/blob/1d82bf7f2d5477d61db916c4868333187a0b10b1/config/escalation/config.go

How can we reproduce it?

git clone [email protected]:ok-amba/provider-jet-opsgenie.git
cd provider-jet-opsgenie
git checkout 1d82bf7f2d5477d61db916c4868333187a0b10b1
make submodules
make reviewable
@Kerwood Kerwood added the bug Something isn't working label Sep 29, 2022
@Kerwood
Copy link
Author

Kerwood commented Nov 24, 2022

Nope.. Still an issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant