summaryrefslogtreecommitdiff
path: root/tests/go.scm
Commit message (Collapse)AuthorAge
* tests: go: Fix typo.Tobias Geerinckx-Rice2021-09-28
| | | | | * tests/go.scm (fixture-go-mod-unparseable): Rename this… (fixture-go-mod-unparsable): …to this. Adjust the only caller.
* import: go: Improve error handling.zimoun2021-09-01
| | | | | | | | | | * guix/import/go.scm (go-module->guix-package*): Handle errors, remove memoize. (go-module-recursive-import): Remove 'guard', add memoize. * guix/scripts/import/go.scm (guix-import-go): Adjust. * tests/go.scm: Adjust. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* import: go: Upgrade go.mod parser.Sarah Morgensen2021-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | Upgrade the go.mod parser to handle the full go.mod spec, and to gracefully handle unexpected/malformed syntax. Restructure parser usage, making the parse tree available for other uses. guix/import/go.scm (parse-go.mod): Parse using (ice-9 peg) instead of regex matching for more robustness. Return a list of directives. (go.mod-directives): New procedure. (go.mod-requirements): Likewise. (go-module->guix-package): Use it. (%go.mod-replace-directive-rx): Remove unused variable. tests/go.scm (testing-parse-mod): Adjust accordingly. (go.mod-requirements) (fixture-go-mod-unparseable) (fixture-go-mod-retract) (fixture-go-mod-strings): New variables. ("parse-go.mod: simple") ("parse-go.mod: comments and unparseable lines") ("parse-go.mod: retract") ("parse-go.mod: raw strings and quoted strings") ("parse-go.mod: complete"): New tests. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
* tests/go: Remove unused variable.Maxim Cournoyer2021-07-17
| | | | | * tests/go.scm: Delete extraneous newline. (fixture-latest-for-go-check): Remove variable.
* tests: go: Remove duplicate go-version->git-ref test.Maxim Cournoyer2021-05-05
| | | | | | | | | | The duplicate test being removed has not much value given that go-version->git-ref is a no-op for version strings not matching the %go-pseudo-version-rx regexp; that case is already tested by the test above. * tests/go.scm ("go-version omited 'v' character"): Remove test. Reported-by: Tobias Geerinckx-Rice <me@tobias.gr>
* tests: go: Fix typos in test descriptions.Tobias Geerinckx-Rice2021-05-04
| | | | * tests/go.scm: Fix ‘embeded’ typos.
* import: go: Add an option to use pinned versions.Maxim Cournoyer2021-04-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ability to pin versions is handy when having to deal to packages that bootstrap themselves through a chain of former versions. Not using pinned versions in these case could introduce dependency cycles. * guix/build-system/go.scm (guix) (%go-version-rx): Rename to... (%go-pseudo-version-rx): ... this. Simplify the regular expression, which in turns makes it more robust. * guix/build-system/go.scm (go-version->git-ref): Adjust following the above rename. (go-pseudo-version?): New predicate. (go-module-latest-version): Rename to ... (go-module-version-string): ... this. Rename goproxy-url argument to just goproxy. Add a VERSION keyword argument, update docstring and adjust to have it used. (go-module-available-versions): New procedure. (%go.mod-require-directive-rx): Document regexp. (parse-go.mod): Harmonize the way dependencies are recorded to a list of lists rather than a list of pairs, as done for other importers. Rewrite to directly pass multiple values rather than a record object. Filter the replaced modules in a functional style. (go-module->guix-package): Add docstring. [version, pin-versions?]: New arguments. Rename the GOPROXY-URL argument to GOPROXY. Adjust to the new returned value of fetch-go.mod, which is a string. Fail when the provided version doesn't exist. Return a list dependencies and their versions when in pinned versions mode, else just the dependencies. (go-module-recursive-import)[version, pin-versions?]: New arguments. Honor the new arguments and guard against network errors. * guix/scripts/import/go.scm (%default-options): Register a default value for the goproxy argument. (show-help): Document that a version can be specified. Remove the --version argument and add a --pin-versions argument. (%options)[version]: Remove option. [pin-versions]: Add option. (guix-import-go): Adjust so the version provided from the module name is honored, along the new pin-versions? argument. * tests/go.scm: Adjust and add new tests.
* import: go: Improve synopsis and description parsing.Maxim Cournoyer2021-04-09
| | | | | | | | | | | | | | | | | | | | | | * guix/import/go.scm (%strict-tokenizer?): Set parameter to #t. (go-path-escape): Redefine to prevent inlining. (http-get*): Replace by ... (http-fetch*): this ... (json-fetch*): New procedure. (go.pkg.dev-info): Use http-fetch*. (go-package-licenses): Rewrite in terms of go.pkg.dev-info. (go-package-description): Likewise. (go-package-synopsis): Likewise. (fetch-go.mod): Use the memoized http-fetch*. (parse-go.mod): Adjust to receive content as a string. (fetch-module-meta-data): Adjust to use http-fetch*. (go-module->guix-package): Adjust to the modified fetch-go.mod return value. [inputs]: Use propagated inputs, which is the most common situations for Go libraries. [description]: Beautify description. [licenses]: Do no check for #f. The result of the license parsing is always a list. * tests/go.scm: Adjust following above changes.
* import: go: Compute the hash of Git checkouts.Ludovic Courtès2021-03-10
| | | | | | * guix/import/go.scm (vcs-file?, file-hash, git-checkout-hash): New procedures. (vcs->origin): Use 'git-checkout-hash' in the 'git case.
* import: Add Go importer.Katherine Cox-Buday2021-03-10
This patch adds a 'guix import go' command. * doc/guix.texi (Requirements): Mention Guile-Lib dependency. (Invoking guix import): Document 'guix import go'. * gnu/packages/package-management.scm (guix)[inputs, propagated-inputs]: Add GUILE-LIB. * guix/self.scm (compiled-guix)[guile-lib]: New variable. [dependencies]: Add it. (specification->package): Add "guile-lib". * guix/build-system/go.scm (go-version->git-ref): New procedure. * guix/import/go.scm, guix/scripts/import/go.scm, tests/go.scm: New files. * guix/scripts/import.scm: Declare subcommand guix import go * po/guix/POTFILES.in: Add 'guix/scripts/import/go.scm'. * Makefile.am (MODULES): Add 'guix/import/go.scm' and 'guix/scripts/import/go.scm'. (SCM_TESTS): Add 'tests/go.scm'. Co-Authored-By: Helio Machado <0x2b3bfa0@gmail.com> Co-Authored-By: Francois Joulaud <francois.joulaud@radiofrance.com> Co-Authored-By: Maxim Cournoyer <maxim.cournoyer@gmail.com> Co-Authored-by: Ludovic Courtès <ludo@gnu.org>