Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gnomod)!: forbid require and find dependencies without it #3123

Merged
merged 117 commits into from
Dec 7, 2024

Conversation

n0izn0iz
Copy link
Contributor

@n0izn0iz n0izn0iz commented Nov 14, 2024

A step towards the importer package (#2932) and future of gno.mod (#2904)

  • BREAKING CHANGE: remove require statement support from gno.mod
  • BREAKING CHANGE: remove -v (verbose) and --remote flags in gno mod download
  • Don't require version specification in gno.mod's replace statements
  • Use .gno files import statements to find dependencies
  • Extract and refacto imports gathering utils in gnovm/pkg/packages
  • Add gnovm/cmd/gno/internal/pkgdownload.PackageFetcher interface
  • Implement PackageFetcher using vm/qfile queries in gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher
  • Rewrite single package download routine in gnovm/cmd/gno/internal/pkgdownload
  • Move and refacto dependencies download routine in gnovm/cmd/gno/download_deps.go
  • Add a --remote-overrides flag for gno mod download that takes chain-domain=rpc-url comma-separated pairs to override endpoints used to fetch packages
  • Add and use a testing implementation of PackageFetcher called examplesPackageFetcher that serves package from the examples directory for testing purposes (download tests before this PR use the portal loop public endpoint)
  • Make ReadMemPackage and it's dependencies error-out instead of panicking
  • Create panicking MemPackage utils that wrap the erroring ones and use them at existing callsites

I decided to do this first to avoid having multiple ways to resolve dependencies lying around in the codebase and causing confusion in subsequent steps

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
Signed-off-by: Norman Meier <[email protected]>
gnovm/cmd/gno/main.go Outdated Show resolved Hide resolved
gnovm/pkg/gnomod/pkg.go Outdated Show resolved Hide resolved
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-approving, mostly looks good now. Here's a few further improvements, that I think you can look to tackle in further PRs:

  1. Stop swallowing errors: there's a bunch of cases we brought up here, errors will happen in these scenarios and we need to report them properly. I understand you didn't want to include it in the scope of this already large PR, but we need to address it
  2. Purify the scope of package gnomod (should be: modules) and move some things to packages, and also change gno mod download -> gno get. Package download is now tied to packages, rather than the requires in the modules; so the command should reflect that. I think gnomod does extra things related to packages, which actually fall outside of its scope.
  3. -u flag: we need a way to force an update from the cache, especially now that we still heavily use the portal loop.

@thehowl thehowl changed the title feat(gnomod): forbid require and find dependencies without it feat(gnomod)!: forbid require and find dependencies without it Dec 7, 2024
@thehowl thehowl merged commit 53cee96 into gnolang:master Dec 7, 2024
105 of 106 checks passed
omarsy pushed a commit to TERITORI/gno that referenced this pull request Dec 7, 2024
…ng#3123)

A step towards the importer package (gnolang#2932) and future of `gno.mod`
(gnolang#2904)

- BREAKING CHANGE: remove `require` statement support from `gno.mod`
- BREAKING CHANGE: remove `-v` (verbose) and `--remote` flags in `gno
mod download`
- Don't require version specification in `gno.mod`'s `replace`
statements
- Use `.gno` files `import` statements to find dependencies
- Extract and refacto imports gathering utils in `gnovm/pkg/packages`
- Add `gnovm/cmd/gno/internal/pkgdownload.PackageFetcher` interface
- Implement `PackageFetcher` using `vm/qfile` queries in
`gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher`
- Rewrite single package download routine in
`gnovm/cmd/gno/internal/pkgdownload`
- Move and refacto dependencies download routine in
`gnovm/cmd/gno/download_deps.go`
- Add a `--remote-overrides` flag for `gno mod download` that takes
`chain-domain=rpc-url` comma-separated pairs to override endpoints used
to fetch packages
- Add and use a testing implementation of `PackageFetcher` called
`examplesPackageFetcher` that serves package from the `examples`
directory for testing purposes (download tests before this PR use the
portal loop public endpoint)
- Make `ReadMemPackage` and it's dependencies error-out instead of
panicking
- Create panicking `MemPackage` utils that wrap the erroring ones and
use them at existing callsites

I decided to do this first to avoid having multiple ways to resolve
dependencies lying around in the codebase and causing confusion in
subsequent steps

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
</details>

---------

Signed-off-by: Norman Meier <[email protected]>
Co-authored-by: Morgan Bazalgette <[email protected]>
notJoon added a commit to gnoverse/tlin that referenced this pull request Dec 9, 2024
# Description

Remove gno mod tidy checker

# Related Issues

-
gnoswap-labs/gnoswap#424 (review)
- gnolang/gno#3123
Villaquiranm pushed a commit to Villaquiranm/gno that referenced this pull request Dec 9, 2024
…ng#3123)

A step towards the importer package (gnolang#2932) and future of `gno.mod`
(gnolang#2904)

- BREAKING CHANGE: remove `require` statement support from `gno.mod`
- BREAKING CHANGE: remove `-v` (verbose) and `--remote` flags in `gno
mod download`
- Don't require version specification in `gno.mod`'s `replace`
statements
- Use `.gno` files `import` statements to find dependencies
- Extract and refacto imports gathering utils in `gnovm/pkg/packages`
- Add `gnovm/cmd/gno/internal/pkgdownload.PackageFetcher` interface
- Implement `PackageFetcher` using `vm/qfile` queries in
`gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher`
- Rewrite single package download routine in
`gnovm/cmd/gno/internal/pkgdownload`
- Move and refacto dependencies download routine in
`gnovm/cmd/gno/download_deps.go`
- Add a `--remote-overrides` flag for `gno mod download` that takes
`chain-domain=rpc-url` comma-separated pairs to override endpoints used
to fetch packages
- Add and use a testing implementation of `PackageFetcher` called
`examplesPackageFetcher` that serves package from the `examples`
directory for testing purposes (download tests before this PR use the
portal loop public endpoint)
- Make `ReadMemPackage` and it's dependencies error-out instead of
panicking
- Create panicking `MemPackage` utils that wrap the erroring ones and
use them at existing callsites

I decided to do this first to avoid having multiple ways to resolve
dependencies lying around in the codebase and causing confusion in
subsequent steps

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
</details>

---------

Signed-off-by: Norman Meier <[email protected]>
Co-authored-by: Morgan Bazalgette <[email protected]>
r3v4s pushed a commit to gnoswap-labs/gno that referenced this pull request Dec 10, 2024
…ng#3123)

A step towards the importer package (gnolang#2932) and future of `gno.mod`
(gnolang#2904)

- BREAKING CHANGE: remove `require` statement support from `gno.mod`
- BREAKING CHANGE: remove `-v` (verbose) and `--remote` flags in `gno
mod download`
- Don't require version specification in `gno.mod`'s `replace`
statements
- Use `.gno` files `import` statements to find dependencies
- Extract and refacto imports gathering utils in `gnovm/pkg/packages`
- Add `gnovm/cmd/gno/internal/pkgdownload.PackageFetcher` interface
- Implement `PackageFetcher` using `vm/qfile` queries in
`gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher`
- Rewrite single package download routine in
`gnovm/cmd/gno/internal/pkgdownload`
- Move and refacto dependencies download routine in
`gnovm/cmd/gno/download_deps.go`
- Add a `--remote-overrides` flag for `gno mod download` that takes
`chain-domain=rpc-url` comma-separated pairs to override endpoints used
to fetch packages
- Add and use a testing implementation of `PackageFetcher` called
`examplesPackageFetcher` that serves package from the `examples`
directory for testing purposes (download tests before this PR use the
portal loop public endpoint)
- Make `ReadMemPackage` and it's dependencies error-out instead of
panicking
- Create panicking `MemPackage` utils that wrap the erroring ones and
use them at existing callsites

I decided to do this first to avoid having multiple ways to resolve
dependencies lying around in the codebase and causing confusion in
subsequent steps

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
</details>

---------

Signed-off-by: Norman Meier <[email protected]>
Co-authored-by: Morgan Bazalgette <[email protected]>
@Kouteki Kouteki removed the in focus Core team is prioritizing this work label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Functionality that contains breaking changes 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Development

Successfully merging this pull request may close these issues.

7 participants