probe-lab/go-kademlia

Prefer a flatter package structure

Closed this issue · 1 comments

iand commented

Currently we tend toward having a separate package for each type. This leads to deep package structures and requires users to import lots of packages and also leads to noisy code since each type is prefixed with a different package name, often the same as the type name.

We should follow a more idiomatic Go style and gather related types into fewer packages which are easier to work with and reduces clutter. Interfaces and implementations can co-exist in the same package, alongside utility functions that work on them. For example Go's io package defines several interfaces (Reader, ByteReader, ReaderAt) with useful types for various use cases (LimitedReader, PipeReader, OffsetWriter) and functions (ReadAll, WriteString).

iand commented

I take the double 👍 as consensus