I guess this doesn't really answer your question, but if you want, you can actually call the methods without explicitly stating the package - just import with a .
in front of the names (but this is not recommended; see below):
package main
import (
. "fmt"
. "io/ioutil"
)
func main () {
content, err := ReadFile("testfile")
if err != nil {
Println("Errors")
}
Println("My file:
", string(content))
}
Note @jimt's comment below - this practice is not advised outside of tests as it could cause name conflicts with future releases. Also, definitely agree with @DavidGrayson's point of being nicer to read/see where things come from.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…