There definitevly was a reason for having package names in code after those packages were declared in an import block. Let’s explore the following code snippet. The second (commented) variant seems easier.
- it’s shorter and faster to write it down
- there is no confusion about what is actually the
Appliances
- an object or a package
So why had this pattern chosen when the language have been formed?
package main
import (
"Factory/Appliances"
"fmt"
)
func main() {
myAppliance, err := Appliances.CreateAppliance()
//myAppliance, err := CreateAppliance()
...