Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Cc: William Hubbs <williamh@g.o>
Subject: [gentoo-dev] [PATCH] go-module.eclass: add helper function to call go
Date: Tue, 22 Feb 2022 15:56:43
Message-Id: 20220222155623.16941-1-williamh@gentoo.org
1 This function will cause the ebuild to die if Go fails.
2 Also, it outputs the go command that is being run.
3
4 Closes: https://bugs.gentoo.org/833497
5 ---
6 eclass/go-module.eclass | 13 +++++++++++++
7 1 file changed, 13 insertions(+)
8
9 diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
10 index 53f4a026942..66fe52c9ad7 100644
11 --- a/eclass/go-module.eclass
12 +++ b/eclass/go-module.eclass
13 @@ -184,6 +184,19 @@ declare -A -g _GOMODULE_GOSUM_REVERSE_MAP
14 # If you enable GO_OPTIONAL, you have to set BDEPEND on >=dev-lang/go-1.12
15 # for your package and call go-module_src_unpack manually.
16
17 +# @FUNCTION: ego
18 +# @USAGE: [<args>...]
19 +# @DESCRIPTION:
20 +# Call go, passing the supplied arguments.
21 +# This function dies if go fails. It also supports being called via 'nonfatal'.
22 +# If you need to call go directly in your ebuilds, this is the way it
23 +# should be done.
24 +ego() {
25 + set -- go "$@"
26 + echo "$@" >&2
27 + "$@" || die -n "${*} failed"
28 +}
29 +
30 # @FUNCTION: go-module_set_globals
31 # @DESCRIPTION:
32 # Convert the information in EGO_SUM for other usage in the ebuild.
33 --
34 2.34.1

Replies