Discussion

Sign in or Join to comment or subscribe

2020-11-14T15:18:07Z ago

I would remove package names.

Packages are already related to directory structure. Both in that all files in a directory must share a package name and in the path which is used for imports.
Naming the package again within the file(s) only add an opportunity for mistakes, since I always want to use the directory name as the package name.

In my experience the relationship between packages and directories was one of the hardest required thing to learn when starting to use go. Other non required things are harder.

Counterpoints. The ‘_test’ and ‘main’ packages are useful. The “/pkgname/v2” should not be named “v2”.

0:00 / 0:00