summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSharlatan Hellseher <[email protected]>2025-01-02 19:53:13 +0000
committerSharlatan Hellseher <[email protected]>2025-01-21 23:47:35 +0000
commit00c6a414821254413405a9912a7e087ae838fbc4 (patch)
tree3219a8331f33ef85a6dacdedf0acd50cf9001d13
parent616e2b026cf9bceaac628a547f095ea39705e260 (diff)
gnu: Add go-github-com-johncgriffin-overflow.
* gnu/packages/golang-maths.scm (go-github-com-johncgriffin-overflow): New variable. Change-Id: I885f4eefbeaf0e41b7add3e6469a0192d2950482
-rw-r--r--gnu/packages/golang-maths.scm41
1 files changed, 41 insertions, 0 deletions
diff --git a/gnu/packages/golang-maths.scm b/gnu/packages/golang-maths.scm
index 957e625cdf..b14533c169 100644
--- a/gnu/packages/golang-maths.scm
+++ b/gnu/packages/golang-maths.scm
@@ -115,6 +115,47 @@ and GCC’s decimal extension.")
(list
#:import-path "github.com/cockroachdb/apd/v3"))))
+(define-public go-github-com-johncgriffin-overflow
+ (package
+ (name "go-github-com-johncgriffin-overflow")
+ (version "0.0.0-20211019200055-46fa312c352c")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/JohnCGriffin/overflow")
+ (commit (go-version->git-ref version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1g4sfhdmzjl5vr16lfv7nv042w8dbz608bwzyvf7xlw4i7ypjjpq"))))
+ (build-system go-build-system)
+ (arguments
+ (list
+ #:import-path "github.com/JohnCGriffin/overflow"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'generate-impl
+ ;; Note that because Go has no template types, the majority of
+ ;; repetitive code is generated by overflow_template.sh. If you
+ ;; have to change an algorithm, change it there and regenerate the
+ ;; Go code.
+ (lambda* (#:key import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ (substitute* "overflow_template.sh"
+ (("/bin/sh") (which "sh")))
+ (make-file-writable "overflow_impl.go")
+ (invoke "./overflow_template.sh")
+ (invoke "go" "generate")))))))
+ (home-page "https://github.com/JohnCGriffin/overflow")
+ (synopsis "Check for int/int64/int32 arithmetic overflow in Golang")
+ (description
+ "This package offers overflow-checked integer arithmetic operations for
+@code{int},@code{int32}, and @code{int64}. Each of the operations returns a
+@code{result,bool} combination. This was prompted by the need to know when to
+flow into higher precision types from the @code{math.big} library.")
+ ;; It's in README, see <https://github.com/JohnCGriffin/overflow/pull/5>.
+ (license license:expat)))
+
(define-public go-github-com-montanaflynn-stats
(package
(name "go-github-com-montanaflynn-stats")