Читать книгу Practical Go - Amit Saha - Страница 18

Go Modules

Оглавление

In this book, all applications will start by initializing a module as the first step. This will translate to running the go command, go mod init <module path>. Throughout the book, I have used a “placeholder” module path, which is github.com/username/<application-name>. Thus, in applications where we have written our module to consist of more than one package, the import path looks like this: github.com/username/<application-name>/<package>.

You can use these module paths if you are not planning to share these applications. If you plan to share your applications, or develop them further, you are encouraged to use your own module path, which is pointing to your own repository, likely a Git repository hosted on https://bitbucket.org, https://github.com or https://gitlab.com. Simply substitute username by your own username in the repository hosting service. It's also worth noting that the code repository for the book, https://github.com/practicalgo/code, contains the module path as github.com/practicalgo/code/<chap1>/<application-name>, in other words, an actual path that exists rather than a placeholder path.

Practical Go

Подняться наверх