Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Fri, 25 Feb 2022 14:30:23
Message-Id: 1645799401.647059f7f484488693e7af9b61d5888382123a03.williamh@gentoo
1 commit: 647059f7f484488693e7af9b61d5888382123a03
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 25 14:29:08 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 25 14:30:01 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=647059f7
7
8 go-module.eclass: add helper function to call go
9
10 This function will cause the ebuild to die if Go fails.
11 Also, it outputs the go command that is being run.
12
13 Closes: https://bugs.gentoo.org/833497
14 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
15
16 eclass/go-module.eclass | 13 +++++++++++++
17 1 file changed, 13 insertions(+)
18
19 diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
20 index 53f4a0269421..66fe52c9ad72 100644
21 --- a/eclass/go-module.eclass
22 +++ b/eclass/go-module.eclass
23 @@ -184,6 +184,19 @@ declare -A -g _GOMODULE_GOSUM_REVERSE_MAP
24 # If you enable GO_OPTIONAL, you have to set BDEPEND on >=dev-lang/go-1.12
25 # for your package and call go-module_src_unpack manually.
26
27 +# @FUNCTION: ego
28 +# @USAGE: [<args>...]
29 +# @DESCRIPTION:
30 +# Call go, passing the supplied arguments.
31 +# This function dies if go fails. It also supports being called via 'nonfatal'.
32 +# If you need to call go directly in your ebuilds, this is the way it
33 +# should be done.
34 +ego() {
35 + set -- go "$@"
36 + echo "$@" >&2
37 + "$@" || die -n "${*} failed"
38 +}
39 +
40 # @FUNCTION: go-module_set_globals
41 # @DESCRIPTION:
42 # Convert the information in EGO_SUM for other usage in the ebuild.