4 ms·
Sure, the go way: import ( "fmt" "github.com/dimuska139/go-email-normalizer" ) func main() { fmt.Println(emailnormalizer.NewNor
by TheDong 6y ago
Sure, the go way:
import (
"fmt"
"github.com/dimuska139/go-email-normalizer"
)
func main() {
fmt.Println(emailnormalizer.NewNormalizer().Normalize("x+1@gmail.com"))
}
Wait, how did I know to do "emailnormalizer.NewNormalizer()"? Well, that's the package name of the package at that url.
The package name is only the same as the last part of the URL in go by convention, and importing a package can put an arbitrary package identifier into your package scope.
- LukeShu 6y agoFWIW, `goimports` would say "OK, technically that's valid, but I'm going to complain unless you explicitly import it as 'emailnormalizer'". import ( "fmt" emailnormalizer "github.com/dimuska139/go-email-normalizer" )
- earthboundkid 6y agoSee https://github.com/golang/go/issues/29036 https://github.com/golang/go/issues/29036 which is still open.
- watt 6y agoand what happened to the "go-" prefix? is it silently dropped?
- sheenobu 6y agoNo. The go files just have "package emailnormalizer" within the go files, so that is the name that you use to reference it, even if the import url is different.