probe-lab / go-kademlia

Generic Go Kademlia implementation
Other
17 stars 4 forks source link

Prefer a flatter package structure #86

Closed iand closed 11 months ago

iand commented 11 months ago

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 11 months ago

I take the double :+1: as consensus