Hacker News new | ask | show | jobs
by andreygrehov 2997 days ago
Off-topic: any reason why so many Go repositories have a flat structure? Wouldn't it be nicer to organize all the *.go files?
2 comments

Part of is is probably because subfolders are subpackages and relative imports don't work and absolute imports have other issues - like causing issues with forking.
> because subfolders are subpackages and relative imports don't work

Really ? Is that a bug, or by design ? If the later, what's the rationnal about it ?

IIRC the tooling is not smart enough to resolve them when you import a subpackage directly.

I was working on a go project and I had to convert all of the relative imports to absolute imports for some reason, but the exact cause escapes my memory.

Import paths are nicer with a flat structure. E.g. the difference between import "github.com/whomever/orm" and import "github.com/whomever/orm/fiz/bang/whiz/resolvers".