Golang packaging: Difference between revisions

From wikinotes
Line 53: Line 53:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
go graph      # show requirements tree
go mod graph      # show requirements tree
go mod tidy    # ensure go.mod matches src
go mod tidy    # ensure go.mod matches src
go mod vendor  #  
go mod vendor  #  
go get ...    # add requirement to go.mod
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Module Requirements -->
</blockquote><!-- Module Requirements -->

Revision as of 04:12, 19 June 2022

Documentation

private modules https://go.dev/ref/mod#private-modules
module proxies https://go.dev/ref/mod#module-proxy
module cache https://go.dev/ref/mod#module-cache

Locations

~/go/bin default $GOBIN path, where go executables are installed

Os Packages

Install Executable

Starting in golang-1.18, go install is used to install executables.

go install github.com/appliedgocode/goman@latest  # install latest goman executable

Public Packages

Private Packages

Go executables are installed/built from src.
You'll need to add your package to $GOPRIVATE envvar to stop it from being indexed.


Project Requirements

Module Requirements

See also go.mod file .

go mod graph       # show requirements tree
go mod tidy    # ensure go.mod matches src
go mod vendor  # 
go get ...     # add requirement to go.mod

Vendoring