GO-MODULE.ECLASS

Section: eclass-manpages (5)
Updated: Feb 2020
Index Return to Main Contents

NAME

go-module.eclass - basic eclass for building software written as go modules

DESCRIPTION

This eclass provides basic settings and functions needed by all software written in the go programming language that uses go modules.

You will know the software you are packaging uses modules because it will have files named go.sum and go.mod in its top-level source directory. If it does not have these files, use the golang-* eclasses.

If it has these files and a directory named vendor in its top-level source directory, you only need to inherit the eclass since upstream is vendoring the dependencies.

If it does not have a vendor directory, you should use the EGO_VENDOR variable and the go-module_vendor_uris function as shown in the example below to handle dependencies.

Since Go programs are statically linked, it is important that your ebuild's LICENSE= setting includes the licenses of all statically linked dependencies. So please make sure it is accurate.

SUPPORTED EAPIS

7

EXAMPLE


inherit go-module

EGO_VENDOR=(
"github.com/xenolf/lego 6cac0ea7d8b28c889f709ec7fa92e92b82f490dd"
"golang.org/x/crypto 453249f01cfeb54c3d549ddb75ff152ca243f9d8 github.com/golang/crypto"
)

SRC_URI="https://github.com/example/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
$(go-module_vendor_uris)"

FUNCTIONS

go-module_vendor_uris
Convert the information in EGO_VENDOR to a format suitable for SRC_URI. A call to this function should be added to SRC_URI in your ebuild if the upstream package does not include vendored dependencies.
go-module_src_unpack
Extract all archives in ${a} which are not nentioned in ${EGO_VENDOR} to their usual locations then extract all archives mentioned in ${EGO_VENDOR} to ${S}/vendor.
go-module_live_vendor
This function is used in live ebuilds to vendor the dependencies when upstream doesn't vendor them.
go-module_pkg_postinst
Display a warning about security updates for Go programs.

ECLASS VARIABLES

EGO_VENDOR
This variable contains a list of vendored packages. The items of this array are strings that contain the import path and the git commit hash for a vendored package. If the import path does not start with github.com, the third argument can be used to point to a github repository.

MAINTAINERS

William Hubbs <williamh@gentoo.org>

REPORTING BUGS

Please report bugs via https://bugs.gentoo.org/

FILES

go-module.eclass

SEE ALSO

ebuild(5)
https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/go-module.eclass


Index

NAME
DESCRIPTION
SUPPORTED EAPIS
EXAMPLE
FUNCTIONS
ECLASS VARIABLES
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:27:03 GMT, February 26, 2020