aboutsummaryrefslogtreecommitdiff
path: root/battering/packages/golang-xyz.scm
diff options
context:
space:
mode:
Diffstat (limited to 'battering/packages/golang-xyz.scm')
-rw-r--r--battering/packages/golang-xyz.scm49
1 files changed, 49 insertions, 0 deletions
diff --git a/battering/packages/golang-xyz.scm b/battering/packages/golang-xyz.scm
index cb2fab7..a7f3a7f 100644
--- a/battering/packages/golang-xyz.scm
+++ b/battering/packages/golang-xyz.scm
@@ -162,3 +162,52 @@ evaluation, enabling different applications to more easily interoperate.")
(file-name (git-file-name (package-name go-github-com-lyft-protoc-gen-star-v2) version))
(sha256
(base32 "1jdgzaq3r1bs12f0a0y84vnrc01m9xzvsk55cvcfspkv14pscqjy"))))))
+
+(define-public go-github-com-envoyproxy-protoc-gen-validate
+ (package
+ (name "go-github-com-envoyproxy-protoc-gen-validate")
+ (version "1.2.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/bufbuild/protoc-gen-validate")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0yd77gnsn9bbiihbkdyn9klwbv314l6ar83z4kivpn9mr93xysch"))))
+ (build-system go-build-system)
+ (arguments
+ (list
+ #:import-path "github.com/envoyproxy/protoc-gen-validate"
+ #:tests? #f ;; Files needs to be generated in `tests/harness/go` in a
+ ;; way I couldn't figure out.
+ #:phases #~(modify-phases %standard-phases
+ (add-before 'check 'generate-harness-testcases
+ (lambda* (#:key import-path tests? #:allow-other-keys)
+ (when tests?
+ (with-directory-excursion (string-append "src/" import-path)
+ (substitute* "Makefile"
+ ;; Change all local protoc-gen-go stuff to the
+ ;; protoc-gen-go package
+ (("\\$\\(shell pwd\\)/bin/protoc-gen-go")
+ #$(file-append protoc-gen-go "/bin/protoc-gen-go"))
+ ;; Remove the bin/protoc-gen-go dependency rule
+ ;; cause it tries to pull protoc-gen-go
+ (("(^[a-z/.]+:) bin/protoc-gen-go" _ rulename)
+ rulename))
+ (setenv "PATH" (format #f "~a/bin:~a" #$output (getenv "PATH")))
+ (invoke "make" "testcases"))))))))
+ (propagated-inputs (list go-google-golang-org-protobuf go-golang-org-x-net
+ go-github-com-lyft-protoc-gen-star-v2-latest
+ go-github-com-iancoleman-strcase
+ protoc-gen-go))
+ (native-inputs (list protobuf))
+ (home-page "https://github.com/envoyproxy/protoc-gen-validate")
+ (synopsis "protoc-gen-validate (PGV)")
+ (description
+ "PGV is a protoc plugin to generate polyglot message validators. While protocol
+buffers effectively guarantee the types of structured data, they cannot enforce
+semantic rules for values. This plugin adds support to protoc-generated code to
+validate such constraints.")
+ (license license:asl2.0)))