gnu: Add go-github-com-go-openapi-loads.

* gnu/packages/golang-web.scm (go-github-com-go-openapi-loads): New
variable.

Co-authored-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Change-Id: If5c3d479064ae04e01035c7c7ff1b61acb406749
This commit is contained in:
Leo Nikkilä 2024-08-24 22:28:19 +01:00 committed by Sharlatan Hellseher
parent 1a9765284e
commit e7bdf27d98
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -1502,6 +1502,69 @@ (define-public go-github-com-go-openapi-jsonreference
prototyped in @url{https://github.com/xeipuuv/gojsonreference}.")
(license license:asl2.0)))
(define-public go-github-com-go-openapi-loads
(package
(name "go-github-com-go-openapi-loads")
(version "0.22.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/go-openapi/loads")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0qlcpdlm4y4v9r2r533aqvrc86b67nj31gsz29x9ilr7smr5299d"))))
(build-system go-build-system)
(arguments
(list
#:import-path "github.com/go-openapi/loads"
#:phases
#~(modify-phases %standard-phases
;; FIXME: pattern schemas/*.json: cannot embed irregular file
;; schemas/jsonschema-draft-04.json
;;
;; This happens due to Golang can't determine the valid directory of
;; the module which is sourced during setup environment phase, but
;; easy resolved after coping to expected directory "vendor" within
;; the current package, see details in Golang source:
;;
;; - URL: <https://github.com/golang/go/blob/>
;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
;; - file: src/cmd/go/internal/load/pkg.go#L2059
(add-before 'build 'copy-input-to-vendor-directory
(lambda* (#:key import-path #:allow-other-keys)
(with-directory-excursion (string-append "src/" import-path)
(mkdir "vendor")
(copy-recursively
(string-append
#$(this-package-input "go-github-com-go-openapi-spec")
"/src/github.com")
"vendor/github.com")
(copy-recursively
(string-append
#$(this-package-input "go-github-com-go-openapi-analysis")
"/src/github.com")
"vendor/github.com"))))
(add-before 'install 'remove-vendor-directory
(lambda* (#:key import-path #:allow-other-keys)
(with-directory-excursion (string-append "src/" import-path)
(delete-file-recursively "vendor")))))))
(native-inputs
(list go-github-com-stretchr-testify))
(propagated-inputs
(list go-github-com-go-openapi-analysis
go-github-com-go-openapi-spec
go-github-com-go-openapi-swag
go-gopkg-in-yaml-v3))
(home-page "https://github.com/go-openapi/loads")
(synopsis "Load OAI specification documents")
(description
"This package implements functionality of loading of @acronym{OpenAPI
Initiative,OAI} specification documents from local or remote locations.
Supports JSON and YAML documents.")
(license license:asl2.0)))
(define-public go-github-com-go-openapi-spec
(package
(name "go-github-com-go-openapi-spec")