Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
proposal: remove package keyword #41788
Presently the "package" is required in each go file. The package dictates the name of the library when imported somewhere else. Often it matches the directory name of the package but not always. In these cases when a library is imported this defined package must be used to call the code from this library instead of the name of the directory.
I think the package keyword should be made optional, only for backwards compatibility, and the directory of the go files should be assumed as package name automatically. This will allow us to simplify refactoring(just rename a directory instead of all uses of the package keyword in that directory), plus it will simplify refactoring imports - there will no longer be a need to scan the imported library and look for the package name, instead the directory name will be used right away. If two packages with the same directory are imported, import aliasing still works like before.
Some may say that package keyword is required for the build functionality, but I think that, since