Overview As per module definition, it is a directory containing a collection of nested and related go packages go.mod at its root. The go.mod file defines the Module import path. Dependency requirements…
Author: admin
Understanding go.sum and go.mod file in Go (Golang)
Note: If you are interested in learning Golang, then for that we have a golang comprehensive tutorial series. Do check it out – Golang Comprehensive Tutorial Series. Now let’s see the current tutorial….
Vendor dependencies of a module in Go (Golang)
Overview If you want to vendor your dependencies, then below command can be used to achieve the same. Example Let’s see an example to better understand. First let’s create a module This…
Understanding Module name or module import path in Go (Golang)
Overview Module is go support for dependency management. A module by definition is a collection of related packages with go.mod at its root. The go.mod file defines the Module import path. Dependency…
//indirect for a dependency in go.mod file in Go (Golang)
Overview As the name suggests //indirect against a dependency in the go.mod file indicates that the dependency is indirect. go.mod file only records the direct dependency. However, it may record an indirect…
Executable and non-executable module in Go (Golang)
Module is a directory containing nested go packages. So essentially module can be treated as a package only which contains the nested package. Now package can be either executable package or utility…
Add a dependency to your project or module in Go (Golang)
Overview Module is go support for dependency management. A module by definition is a collection of related packages with go.mod at its root. The go.mod file defines the Module import path Dependency…
What does go mod tidy do in Go (Golang)
Overview This command will basically match the go.mod file with the dependencies required in the source files. Download all the dependencies that are required in your source files and update go.mod file…
Importing package within the same module in Go (Golang)
Any package within the same module can be imported using the import path of module + directory containing that package. To illustrate lets create a module Make a learn directory Create a…
Importing package from different module locally in Go (Golang)
There are cases when we want to import a module which is present locally. Let’s understand how we can import such module. But first, we have to create a module that can…