Reputation: 2758
Can Go modules be built as an executable program? Or, are they meant to be published as libraries for code reuse?
Upvotes: 1
Views: 803
Reputation: 31681
Building an executable and publishing a library are not mutually exclusive (note that modules are not compiled, packages are).
A module is a collection of related Go packages that are versioned together as a single unit.
Modules record precise dependency requirements and create reproducible builds.
https://github.com/golang/go/wiki/Modules#modules
Whether these packages contain a main package or not is irrelevant.
Upvotes: 6
Reputation: 1840
They're intended to work as packages, like something you would install from NPM for a JavaScript project, or from PIP in a Python project.
Upvotes: 4