public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] go-module.eclass: add helper function to call go
@ 2022-02-22 15:56 William Hubbs
  2022-02-26  3:44 ` William Hubbs
  0 siblings, 1 reply; 2+ messages in thread
From: William Hubbs @ 2022-02-22 15:56 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs

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
---
 eclass/go-module.eclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index 53f4a026942..66fe52c9ad7 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.
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] [PATCH] go-module.eclass: add helper function to call go
  2022-02-22 15:56 [gentoo-dev] [PATCH] go-module.eclass: add helper function to call go William Hubbs
@ 2022-02-26  3:44 ` William Hubbs
  0 siblings, 0 replies; 2+ messages in thread
From: William Hubbs @ 2022-02-26  3:44 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 39 bytes --]

This is in the tree.

Thanks,

William

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-26  3:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22 15:56 [gentoo-dev] [PATCH] go-module.eclass: add helper function to call go William Hubbs
2022-02-26  3:44 ` William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox