Skip to content

Reorganize code layout #49

@juli4n

Description

The current code layout grew fast and organically, and doesn't follow any rule / invariant.

We have most Substrate binaries under /cmd//... although each one structures its packages in a different way. We also have api/, pkg/ internal/ etc.

This proposal tries to introduce some rules so we can have:

  • Packages that can be imported by downstream projects in a safe way (no breakages).
  • Clean separation of production code vs dev tooling.
  • A common place for internal shared packages.
  • A common place for internal per component packages.

A good starting point could be:

  • cmd/<component>/main.go for the component main packages / entrypoints.
  • internal/<component> for component specific specific packages.
  • internal for internal shared packages (across components).
  • pkg for the shared public packages.
  • hack/ dev scripts.
  • tools/<tool-name>: dev tools (e.g. benchmarking, load testing).

Metadata

Metadata

Labels

cleanupSmall fixes that are not bugs, for example a typo in a code comment

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions