Skip to content

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

@timofurrer

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

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