Go Modules: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 33: Line 33:
=Module Proxy Server=
=Module Proxy Server=
=Module Cache=
=Module Cache=
=Organizatorium=
* When your code imports packages contained in other modules, you manage those dependencies through your code's own module.

Revision as of 19:55, 8 September 2023

Internal

TO PROCESS

To process:

Overview

A module is a collection of related packages that are released, versioned and distributed together.

Packages are published as modules.

The module contains the packages in the directory containing its go.mod file as well as subdirectories of that directory, up to the next subdirectory containing another go.mod file (if any).

Modules may be downloaded directly from version control repositories, or from module proxy servers.

Modules have been introduced in Go 1.11.

Declaring Modules

Building Modules

Publishing Modules

Consuming Modules

go.mod

go.mod declares the module path, which is the import path prefix for all packages within the module.

Module Path

A module path serves as import path prefix for its packages. It also indicates where the go tool command should look to download it. For example, to download the module golang.org/x/tools, the go tool should go to the repository indicated by https://golang.org/x/tools.

Module Proxy Server

Module Cache

Organizatorium

  • When your code imports packages contained in other modules, you manage those dependencies through your code's own module.