diff options
author | Hanketsu <hanketsu@egregore.fun> | 2025-01-31 23:09:55 +0100 |
---|---|---|
committer | Hanketsu <hanketsu@egregore.fun> | 2025-06-13 00:04:22 +0200 |
commit | 8c7b1f759d44d6b246deef8f1e2f6c0170f86c85 (patch) | |
tree | 7c3b379ed66b084b59ab05d182b21426697077d2 | |
parent | 41f09493474d9cb3d2b1fba94ad09894b381204b (diff) |
battering: Add go-github-com-envoyproxy-protoc-gen-validate.
* battering/packages/golang-xyz.scm (go-github-com-envoyproxy-protoc-gen-validate): New variable.
-rw-r--r-- | battering/packages/golang-xyz.scm | 49 |
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))) |