Go Import Paths
vntw opened this issue · 3 comments
While checking out the code I saw that you're importing your own modules like std library packages. This looks dangerous and might cause conflicts should the std lib ever introduce a package with the same name.
I'm relatively new to Go but read How to Write Go Code where this is discussed:
The packages from the standard library are given short import paths such as "fmt" and "net/http". For your own packages, you must choose a base path that is unlikely to collide with future additions to the standard library or other external libraries.
So github.com/DeKugelschieber/acweb
looks like the best option
WDYT?
acweb is not a library, so there won't be any collisions since no one will import acweb as a library using github.com/DeKugelschieber/acweb. And the base name "acweb" is unlikly to be picked as a standard library package name.
That's not what I meant, look at https://github.com/DeKugelschieber/acweb/blob/master/src/main/main.go#L4-L11 if Go ever introduces a package named rest
or db
it will create conflicts.
That's right, but I think it's possible to fix it should it occur. You can rename packages or use a differente name when importing them:
import (
mypackage "foo/bar/strconv" // strconv exists in the standard library
)
mypackage.DoSomething()
This really shouldn't be an issue.