Skip to content

Commit d5d298c

Browse files
n0izn0izthehowl
authored andcommitted
feat(gnomod)!: forbid require and find dependencies without it (gnolang#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]>
1 parent 03b7c0e commit d5d298c

File tree

171 files changed

+988
-1999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+988
-1999
lines changed

contribs/gnodev/pkg/dev/packages.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func (pm PackagesMap) Load(fee std.Fee, start time.Time) ([]gnoland.TxWithMetada
138138
}
139139

140140
// Open files in directory as MemPackage.
141-
memPkg := gno.ReadMemPackage(modPkg.Dir, modPkg.Name)
141+
memPkg := gno.MustReadMemPackage(modPkg.Dir, modPkg.Name)
142142
if err := memPkg.Validate(); err != nil {
143143
return nil, fmt.Errorf("invalid package: %w", err)
144144
}

contribs/gnogenesis/go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ require (
5353
golang.org/x/sys v0.24.0 // indirect
5454
golang.org/x/term v0.23.0 // indirect
5555
golang.org/x/text v0.17.0 // indirect
56-
golang.org/x/tools v0.24.0 // indirect
5756
google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect
5857
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect
5958
google.golang.org/grpc v1.65.0 // indirect

contribs/gnogenesis/go.sum

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contribs/gnomigrate/go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ require (
4848
golang.org/x/sys v0.24.0 // indirect
4949
golang.org/x/term v0.23.0 // indirect
5050
golang.org/x/text v0.17.0 // indirect
51-
golang.org/x/tools v0.24.0 // indirect
5251
google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect
5352
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect
5453
google.golang.org/grpc v1.65.0 // indirect

contribs/gnomigrate/go.sum

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/gno.land/p/demo/acl/gno.mod

-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
module gno.land/p/demo/acl
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/testutils v0.0.0-latest
6-
gno.land/p/demo/uassert v0.0.0-latest
7-
gno.land/p/demo/ufmt v0.0.0-latest
8-
)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
module gno.land/p/demo/avl/pager
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/uassert v0.0.0-latest
6-
gno.land/p/demo/ufmt v0.0.0-latest
7-
gno.land/p/demo/urequire v0.0.0-latest
8-
)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/avlhelpers
2-
3-
require gno.land/p/demo/avl v0.0.0-latest

examples/gno.land/p/demo/blog/gno.mod

-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
module gno.land/p/demo/blog
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/mux v0.0.0-latest
6-
gno.land/p/demo/ufmt v0.0.0-latest
7-
)

examples/gno.land/p/demo/dao/gno.mod

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/dao
2-
3-
require gno.land/p/demo/ufmt v0.0.0-latest

examples/gno.land/p/demo/dom/gno.mod

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/dom
2-
3-
require gno.land/p/demo/avl v0.0.0-latest
-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/fqname
2-
3-
require gno.land/p/demo/uassert v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/demo/gnorkle/agent
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/uassert v0.0.0-latest
6-
)
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
11
module gno.land/p/demo/gnorkle/feeds/static
2-
3-
require (
4-
gno.land/p/demo/gnorkle/feed v0.0.0-latest
5-
gno.land/p/demo/gnorkle/gnorkle v0.0.0-latest
6-
gno.land/p/demo/gnorkle/ingester v0.0.0-latest
7-
gno.land/p/demo/gnorkle/ingesters/single v0.0.0-latest
8-
gno.land/p/demo/gnorkle/message v0.0.0-latest
9-
gno.land/p/demo/gnorkle/storage/simple v0.0.0-latest
10-
gno.land/p/demo/uassert v0.0.0-latest
11-
gno.land/p/demo/ufmt v0.0.0-latest
12-
gno.land/p/demo/urequire v0.0.0-latest
13-
)
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
11
module gno.land/p/demo/gnorkle/gnorkle
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/gnorkle/agent v0.0.0-latest
6-
gno.land/p/demo/gnorkle/feed v0.0.0-latest
7-
gno.land/p/demo/gnorkle/ingester v0.0.0-latest
8-
gno.land/p/demo/gnorkle/message v0.0.0-latest
9-
)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
module gno.land/p/demo/gnorkle/ingesters/single
2-
3-
require (
4-
gno.land/p/demo/gnorkle/gnorkle v0.0.0-latest
5-
gno.land/p/demo/gnorkle/ingester v0.0.0-latest
6-
gno.land/p/demo/gnorkle/storage/simple v0.0.0-latest
7-
gno.land/p/demo/uassert v0.0.0-latest
8-
)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/gnorkle/message
2-
3-
require gno.land/p/demo/uassert v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
11
module gno.land/p/demo/gnorkle/storage/simple
2-
3-
require (
4-
gno.land/p/demo/gnorkle/feed v0.0.0-latest
5-
gno.land/p/demo/gnorkle/storage v0.0.0-latest
6-
gno.land/p/demo/uassert v0.0.0-latest
7-
gno.land/p/demo/ufmt v0.0.0-latest
8-
gno.land/p/demo/urequire v0.0.0-latest
9-
)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
module gno.land/p/demo/grc/grc1155
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/uassert v0.0.0-latest
6-
gno.land/p/demo/ufmt v0.0.0-latest
7-
)
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
11
module gno.land/p/demo/grc/grc20
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/grc/exts v0.0.0-latest
6-
gno.land/p/demo/testutils v0.0.0-latest
7-
gno.land/p/demo/uassert v0.0.0-latest
8-
gno.land/p/demo/ufmt v0.0.0-latest
9-
gno.land/p/demo/urequire v0.0.0-latest
10-
)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
module gno.land/p/demo/grc/grc721
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/testutils v0.0.0-latest
6-
gno.land/p/demo/uassert v0.0.0-latest
7-
gno.land/p/demo/ufmt v0.0.0-latest
8-
)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/grc/grc777
2-
3-
require gno.land/p/demo/grc/exts v0.0.0-latest
-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/groups
2-
3-
require gno.land/p/demo/rat v0.0.0-latest
-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/int256
2-
3-
require gno.land/p/demo/uint256 v0.0.0-latest

examples/gno.land/p/demo/json/gno.mod

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/json
2-
3-
require gno.land/p/demo/ufmt v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/math_eval/int32
2-
3-
require gno.land/p/demo/ufmt v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
11
module gno.land/p/demo/membstore
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/testutils v0.0.0-latest
6-
gno.land/p/demo/uassert v0.0.0-latest
7-
gno.land/p/demo/ufmt v0.0.0-latest
8-
gno.land/p/demo/urequire v0.0.0-latest
9-
)
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
11
module gno.land/p/demo/memeland
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/ownable v0.0.0-latest
6-
gno.land/p/demo/seqid v0.0.0-latest
7-
gno.land/p/demo/testutils v0.0.0-latest
8-
gno.land/p/demo/uassert v0.0.0-latest
9-
gno.land/p/demo/ufmt v0.0.0-latest
10-
)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/demo/microblog
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/ufmt v0.0.0-latest
6-
)
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
11
module gno.land/p/demo/ownable/exts/authorizable
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/ownable v0.0.0-latest
6-
gno.land/p/demo/testutils v0.0.0-latest
7-
gno.land/p/demo/uassert v0.0.0-latest
8-
gno.land/p/demo/ufmt v0.0.0-latest
9-
)
-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/demo/ownable
2-
3-
require (
4-
gno.land/p/demo/testutils v0.0.0-latest
5-
gno.land/p/demo/uassert v0.0.0-latest
6-
)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/demo/pausable
2-
3-
require (
4-
gno.land/p/demo/ownable v0.0.0-latest
5-
gno.land/p/demo/urequire v0.0.0-latest
6-
)
-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/seqid
2-
3-
require gno.land/p/demo/cford32 v0.0.0-latest
-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
11
module gno.land/p/demo/simpledao
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/dao v0.0.0-latest
6-
gno.land/p/demo/membstore v0.0.0-latest
7-
gno.land/p/demo/seqid v0.0.0-latest
8-
gno.land/p/demo/testutils v0.0.0-latest
9-
gno.land/p/demo/uassert v0.0.0-latest
10-
gno.land/p/demo/ufmt v0.0.0-latest
11-
gno.land/p/demo/urequire v0.0.0-latest
12-
)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
module gno.land/p/demo/subscription/lifetime
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/ownable v0.0.0-latest
6-
gno.land/p/demo/testutils v0.0.0-latest
7-
gno.land/p/demo/uassert v0.0.0-latest
8-
)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
module gno.land/p/demo/subscription/recurring
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/ownable v0.0.0-latest
6-
gno.land/p/demo/testutils v0.0.0-latest
7-
gno.land/p/demo/uassert v0.0.0-latest
8-
)

examples/gno.land/p/demo/svg/gno.mod

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/svg
2-
3-
require gno.land/p/demo/ufmt v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/tamagotchi
2-
3-
require gno.land/p/demo/ufmt v0.0.0-latest
-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/demo/tests
2-
3-
require (
4-
gno.land/p/demo/tests/subtests v0.0.0-latest
5-
gno.land/p/demo/uassert v0.0.0-latest
6-
)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/demo/todolist
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/uassert v0.0.0-latest
6-
)
-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/uassert
2-
3-
require gno.land/p/demo/diff v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/urequire
2-
3-
require gno.land/p/demo/uassert v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/watchdog
2-
3-
require gno.land/p/demo/uassert v0.0.0-latest
-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
module gno.land/p/gov/executor
2-
3-
require (
4-
gno.land/p/demo/context v0.0.0-latest
5-
gno.land/p/demo/uassert v0.0.0-latest
6-
gno.land/p/demo/urequire v0.0.0-latest
7-
)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/moul/helplink
2-
3-
require (
4-
gno.land/p/demo/urequire v0.0.0-latest
5-
gno.land/p/moul/txlink v0.0.0-latest
6-
)
-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/moul/mdtable
2-
3-
require gno.land/p/demo/urequire v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/demo/printfdebugging
2-
3-
require gno.land/p/demo/ufmt v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/moul/realmpath
2-
3-
require (
4-
gno.land/p/demo/uassert v0.0.0-latest
5-
gno.land/p/demo/urequire v0.0.0-latest
6-
)
-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
module gno.land/p/moul/txlink
2-
3-
require gno.land/p/demo/urequire v0.0.0-latest
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/n2p5/haystack
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/n2p5/haystack/needle v0.0.0-latest
6-
)
-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
module gno.land/p/n2p5/mgroup
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/ownable v0.0.0-latest
6-
gno.land/p/demo/testutils v0.0.0-latest
7-
)

examples/gno.land/p/nt/poa/gno.mod

-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
11
module gno.land/p/nt/poa
2-
3-
require (
4-
gno.land/p/demo/avl v0.0.0-latest
5-
gno.land/p/demo/testutils v0.0.0-latest
6-
gno.land/p/demo/uassert v0.0.0-latest
7-
gno.land/p/demo/ufmt v0.0.0-latest
8-
gno.land/p/demo/urequire v0.0.0-latest
9-
gno.land/p/sys/validators v0.0.0-latest
10-
)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
module gno.land/p/wyhaines/rand/isaac
2-
3-
require (
4-
gno.land/p/demo/entropy v0.0.0-latest
5-
gno.land/p/demo/ufmt v0.0.0-latest
6-
gno.land/p/wyhaines/rand/xorshiftr128plus v0.0.0-latest
7-
)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
module gno.land/p/wyhaines/rand/isaac64
2-
3-
require (
4-
gno.land/p/demo/entropy v0.0.0-latest
5-
gno.land/p/demo/ufmt v0.0.0-latest
6-
gno.land/p/wyhaines/rand/xorshiftr128plus v0.0.0-latest
7-
)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/wyhaines/rand/xorshift64star
2-
3-
require (
4-
gno.land/p/demo/entropy v0.0.0-latest
5-
gno.land/p/demo/ufmt v0.0.0-latest
6-
)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
module gno.land/p/wyhaines/rand/xorshiftr128plus
2-
3-
require (
4-
gno.land/p/demo/entropy v0.0.0-latest
5-
gno.land/p/demo/ufmt v0.0.0-latest
6-
)

0 commit comments

Comments
 (0)