Skip to content

proposal: Go 2: allow import cycle #30247

@minkofski

Description

@minkofski

I understand that disallow import cycle is intentional in Go design.
However, solving the import cycle issue makes me frustrated.
And, it is easy to write two coupling components that rely on each other

  • Although we can use interface can address the issue, it decreases the readability since a developer must carefully read the source to find out which instance is represented by the interface (abuse of interface).
  • There are many Go standard package rely on runtime private calls and uses go:linkname to address the import cycle problem. However, it is still a hack and not recommended by the Go team.

I believe many people encounter import cycle issue and spend time on code refactoring, which is good, but this is unforgivable in business logic development sometimes.

Concern: How much compile time will be sacrificed while introducing dependency analysis? Is there any recent research advances for rapid dependency analysis can be integrated?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions