Problem
Packages that build up a large list of files can become rather cumbersome to work with. For example an entity package for a game server could start to become frustrating to navigate after enough entities are created e.g.:
|---> entity
|---> character.go
|---> chat.go
|---> monster.go
|---> attack.go
|---> map.go
|---> item.go
|---> drop.go
|---> characterPacket.go
|---> chatPacket.go
|---> monsterPacket.go
|---> attackPacket.go
|---> mapPacket.go
|---> itemPacket.go
|---> dropPacket.go
|---> ....
As more entities are created it becomes exceedingly frustrating to find a file/struct/function of interest.
Proposal
Allow the use of folders within a package starting with "__" or "_" to retain the parent package's 'namespace'. The above file layout could be turned into:
|---> entity
|---> character.go
|---> chat.go
|---> monster.go
|---> attack.go
|---> map.go
|---> item.go
|---> drop.go
|---> ....
|---> __packet
|---> characterPacket.go
|---> chatPacket.go
|---> monsterPacket.go
|---> attackPacket.go
|---> mapPacket.go
|---> itemPacket.go
|---> dropPacket.go
|---> ....
Since the files under the __packet folder are still part of the entity package they are able to use the data structures and functions stored in the parent folder and the parent folder files are able to call the functions in the __packet folder without causing cyclical dependency issues.
Problem
Packages that build up a large list of files can become rather cumbersome to work with. For example an entity package for a game server could start to become frustrating to navigate after enough entities are created e.g.:
As more entities are created it becomes exceedingly frustrating to find a file/struct/function of interest.
Proposal
Allow the use of folders within a package starting with "__" or "_" to retain the parent package's 'namespace'. The above file layout could be turned into:
Since the files under the
__packetfolder are still part of the entity package they are able to use the data structures and functions stored in the parent folder and the parent folder files are able to call the functions in the__packetfolder without causing cyclical dependency issues.