Skip to content

Enforce that only deeper "nested" packages can be imported but no siblings #112

Description

@timofurrer

Is it somehow possible to enforce that only deeper nested packages can be imported but no siblings (of any level), for example:

internal/commands/
├── project/
│   ├── main.go              ← Can import view/, create/, publish/ and everything in internal/ (but nothing else in internal/commands/)
│   ├── view/
│   │   └── list.go          ← Cannot import ../create/ or ../../release/create 
│   ├── create/
│   │   └── main.go          ← Cannot import ../view/ or ../publish/catalog
│   └── publish/
│       ├── main.go          ← Cannot import ../view/ or ../../release/create
│       └── catalog/
│           └── sync.go      ← Cannot import any other subpackages
├── release/
│   ├── main.go              ← Can import create/, publish/
│   ├── create/
│   │   └── main.go          ← Cannot import ../../project/publish/catalog
│   └── publish/
│       └── main.go          ← Cannot import ../create/ or ../../project/view

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions