Description
Since the folder structure generally dictates what your package name will be, it might be nice to remove the extra package <ident>
declaration. For backwards compatibility, package <ident>
could be optional.
One issue is when you use hyphens like foo-bar/foo-bar.go
has package foobar
, but I'd consider that generally bad practice anyway.
Another consideration is tests, but in that case we could use the filename *_test.go
to dictate the package name. There may also be issues with package main
, but could maybe default to the filename main.go
as defaulting to package main
.
I'm probably not be considering all the cases, but it does seem quite repetitive in general and it doesn't seem to add much, if anything it adds confusion when your package name isn't the same as your file directory. This is especially true when refactoring.
I'm curious to hear what you all think!