This question already has an answer here:
- Import everything from a package 1 answer
Is there a way to use the names in a golang import without specifying the package name each time? In C++ I can "use" a nampespace. In Java, when I import something, the namespace is automatically used.
Sometimes I have a high level helper library, who's main purpose is using another pacakge, and providing some high level wrappers for it. It seems overly verbose to keep using the pacakge name over and over in the code.
package myhighlevellibrary
import "mypackage"
func Foo() *mypackage.SomeType{
a:=mypackage.Somefunction();
b:=mypackage.SomeFactoryMethod(a);
return b
}
Can I somehow avoid writing the "mypackage" literal so many times in my code? It gets much worse as my library grows larger...
</div>