doubeishuai6598 2015-12-07 06:39
浏览 358

Go Lang工作区重复包名称可执行冲突

If following the GoLang documentation for workspace structure it is possible that two executable packages will share the same package name.

For example, there are two packages from github:

$ $GOPATH/src/github.com/alpha/import
$ $GOPATH/src/github.com/beta/import

The import package from user alpha is first installed:

$ go install github.com/alpha/import

The binary executable is now available in $GOPATH/bin and is named import.

Then the second package from user beta is installed:

$ go install github.com/beta/import

This install/build will replace the existing import binary from user alpha with the import binary from user beta.

A better naming convention could avoid this collision; however, is there a standard practice for fixing this issue when using third party libraries?

  • 写回答

1条回答 默认 最新

  • dongyoudi1342 2015-12-07 06:50
    关注

    This collision happens only for executables and never for packages. Executables are much less common and often have distinguishing names so in practice I never encountered this problem.

    The "fix" or "best practice" is obvious and dead simple: Just rename the binary after installing.

    评论

报告相同问题?