summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2022-02-25 08:29:08 -0600
committerWilliam Hubbs <williamh@gentoo.org>2022-02-25 08:30:01 -0600
commit647059f7f484488693e7af9b61d5888382123a03 (patch)
tree6c703ff8c25a32ae10a8edc25a54640819ebb7cd /eclass/go-module.eclass
parentsys-fs/fscrypt: add 0.3.3 (diff)
downloadgentoo-647059f7f484488693e7af9b61d5888382123a03.tar.gz
gentoo-647059f7f484488693e7af9b61d5888382123a03.tar.bz2
gentoo-647059f7f484488693e7af9b61d5888382123a03.zip
go-module.eclass: add helper function to call go
This function will cause the ebuild to die if Go fails. Also, it outputs the go command that is being run. Closes: https://bugs.gentoo.org/833497 Signed-off-by: William Hubbs <williamh@gentoo.org>
Diffstat (limited to 'eclass/go-module.eclass')
-rw-r--r--eclass/go-module.eclass13
1 files changed, 13 insertions, 0 deletions
diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index 53f4a0269421..66fe52c9ad72 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -184,6 +184,19 @@ declare -A -g _GOMODULE_GOSUM_REVERSE_MAP
# If you enable GO_OPTIONAL, you have to set BDEPEND on >=dev-lang/go-1.12
# for your package and call go-module_src_unpack manually.
+# @FUNCTION: ego
+# @USAGE: [<args>...]
+# @DESCRIPTION:
+# Call go, passing the supplied arguments.
+# This function dies if go fails. It also supports being called via 'nonfatal'.
+# If you need to call go directly in your ebuilds, this is the way it
+# should be done.
+ego() {
+ set -- go "$@"
+ echo "$@" >&2
+ "$@" || die -n "${*} failed"
+}
+
# @FUNCTION: go-module_set_globals
# @DESCRIPTION:
# Convert the information in EGO_SUM for other usage in the ebuild.