Skip to content

Commit

Permalink
feat: implement gno mod tidy (gnolang#1035)
Browse files Browse the repository at this point in the history
Contains initial implementation of `gno mod tidy`

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

- [ ] 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
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
Co-authored-by: Morgan <git@howl.moe>
  • Loading branch information
3 people committed Nov 14, 2023
1 parent 9040e7a commit bc281eb
Show file tree
Hide file tree
Showing 55 changed files with 488 additions and 133 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,22 @@ jobs:
- run: go run ./gnovm/cmd/gno lint --verbose ./examples/gno.land/r/gnoland
- run: go run ./gnovm/cmd/gno lint --verbose ./examples/gno.land/r/system
# TODO: track coverage
mod-tidy:
strategy:
fail-fast: false
matrix:
go-version: [ "1.21.x" ]
# unittests: TODO: matrix with contracts
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- run: |
GNO_CMD="$(pwd)/gnovm/cmd/gno"
# Find all directories containing gno.mod file
find ./examples -name "gno.mod" -execdir go run "$GNO_CMD" mod tidy \;
# Check if there are changes after running gno mod tidy
git diff --exit-code || (echo "Some gno.mod files are not tidy, please run 'make tidy'." && exit 1)
4 changes: 4 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ clean:
GOFMT_FLAGS ?= -w
fmt:
go run -modfile ../misc/devdeps/go.mod mvdan.cc/gofumpt $(GOFMT_FLAGS) `find . -name "*.gno"`

.PHONY: tidy
tidy:
find . -name "gno.mod" -execdir go run github.com/gnolang/gno/gnovm/cmd/gno mod tidy \;
4 changes: 2 additions & 2 deletions examples/gno.land/p/demo/acl/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/p/demo/acl

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/testutils" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/p/demo/blog/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/p/demo/blog

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/p/demo/mux" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/mux v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
)
4 changes: 1 addition & 3 deletions examples/gno.land/p/demo/dom/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/p/demo/dom

require (
"gno.land/p/demo/avl" v0.0.0-latest
)
require gno.land/p/demo/avl v0.0.0-latest
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/flow/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module "gno.land/p/demo/flow"
module gno.land/p/demo/flow
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/gnode/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module "gno.land/p/demo/gnode"
module gno.land/p/demo/gnode
4 changes: 2 additions & 2 deletions examples/gno.land/p/demo/grc/exts/vault/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/p/demo/grc/exts/vault

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/grc/grc20" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/grc/grc20 v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/p/demo/grc/grc1155/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/p/demo/grc/grc1155

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/p/demo/grc/grc20/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/p/demo/grc/grc20

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/p/demo/grc/exts" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/grc/exts v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/p/demo/grc/grc721/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/p/demo/grc/grc721

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
4 changes: 1 addition & 3 deletions examples/gno.land/p/demo/grc/grc777/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/p/demo/grc/grc777

require (
"gno.land/p/demo/grc/exts" v0.0.0-latest
)
require gno.land/p/demo/grc/exts v0.0.0-latest
5 changes: 2 additions & 3 deletions examples/gno.land/p/demo/groups/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module gno.land/p/demo/groups

require (
"gno.land/r/demo/boards" v0.0.0-latest
"gno.land/p/demo/maths" v0.0.0-latest
"gno.land/p/demo/testutils" v0.0.0-latest
gno.land/p/demo/maths v0.0.0-latest
gno.land/r/demo/boards v0.0.0-latest
)
4 changes: 1 addition & 3 deletions examples/gno.land/p/demo/math_eval/int32/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/p/demo/math_eval/int32

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
)
require gno.land/p/demo/ufmt v0.0.0-latest
7 changes: 4 additions & 3 deletions examples/gno.land/p/demo/microblog/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module gno.land/p/demo/microblog

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/mux/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module "gno.land/p/demo/mux"
module gno.land/p/demo/mux
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/rand/gno.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Draft

module gno.land/p/demo/rand
module gno.land/p/demo/rand
4 changes: 1 addition & 3 deletions examples/gno.land/p/demo/svg/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/p/demo/svg

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
)
require gno.land/p/demo/ufmt v0.0.0-latest
4 changes: 2 additions & 2 deletions examples/gno.land/p/demo/tests/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/p/demo/tests

require (
"gno.land/p/demo/tests/subtests" v0.0.0-latest
"gno.land/r/demo/tests" v0.0.0-latest
gno.land/p/demo/tests/subtests v0.0.0-latest
gno.land/r/demo/tests v0.0.0-latest
)
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/tests/subtests/gno.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module gno.land/p/demo/tests/subtests

// TODO: this file should not exist.
// TODO: this file should not exist.
// This is a temporary workaround. Until https://github.com/gnolang/gno/issues/852
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/ui/gno.mod
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module "gno.land/p/demo/ui"
module gno.land/p/demo/ui
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/art/gnoface/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/demo/art/gnoface

require (
"gno.land/p/demo/rand" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
gno.land/p/demo/rand v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
)
4 changes: 1 addition & 3 deletions examples/gno.land/r/demo/art/millipede/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/r/demo/art/millipede

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
)
require gno.land/p/demo/ufmt v0.0.0-latest
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/boards/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/demo/boards

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/r/demo/foo1155/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/r/demo/foo1155

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/p/demo/grc/grc1155" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
gno.land/p/demo/grc/grc1155 v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/r/demo/foo20/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/r/demo/foo20

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/p/demo/grc/grc20" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
gno.land/p/demo/grc/grc20 v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/r/demo/foo721/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/r/demo/foo721

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/p/demo/grc/grc721" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
gno.land/p/demo/grc/grc721 v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/groups/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/demo/groups

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
5 changes: 3 additions & 2 deletions examples/gno.land/r/demo/keystore/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module gno.land/r/demo/keystore

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/p/demo/avl" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
)
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/math_eval/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/demo/math_eval

require (
"gno.land/p/demo/ufmt" v0.0.0-latest
"gno.land/p/demo/math_eval/int32" v0.0.0-latest
gno.land/p/demo/math_eval/int32 v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
)
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/microblog/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/demo/microblog

require (
"gno.land/p/demo/microblog" v0.0.0-latest
"gno.land/r/demo/users" v0.0.0-latest
gno.land/p/demo/microblog v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/nft/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/demo/nft

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/grc/grc721" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/grc/grc721 v0.0.0-latest
)
4 changes: 1 addition & 3 deletions examples/gno.land/r/demo/releases_example/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/r/demo/releases_example

require (
"gno.land/p/demo/releases" v0.0.0-latest
)
require gno.land/p/demo/releases v0.0.0-latest
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/tests/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/demo/tests

require (
"gno.land/p/demo/testutils" v0.0.0-latest
"gno.land/r/demo/tests/subtests" v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
gno.land/r/demo/tests/subtests v0.0.0-latest
)
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/tests/subtests/gno.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module gno.land/r/demo/tests/subtests

// TODO: this file should not exist.
// TODO: this file should not exist.
// This is a temporary workaround. Until https://github.com/gnolang/gno/issues/852
4 changes: 1 addition & 3 deletions examples/gno.land/r/demo/tests_foo/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/r/demo/tests_foo

require (
"gno.land/r/demo/tests" v0.0.0-latest
)
require gno.land/r/demo/tests v0.0.0-latest
4 changes: 1 addition & 3 deletions examples/gno.land/r/demo/types/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/r/demo/types

require (
"gno.land/p/demo/avl" v0.0.0-latest
)
require gno.land/p/demo/avl v0.0.0-latest
4 changes: 1 addition & 3 deletions examples/gno.land/r/demo/ui/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/r/demo/ui

require (
"gno.land/p/demo/ui" v0.0.0-latest
)
require gno.land/p/demo/ui v0.0.0-latest
5 changes: 1 addition & 4 deletions examples/gno.land/r/demo/users/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
module gno.land/r/demo/users

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/testutils" v0.0.0-latest
)
require gno.land/p/demo/avl v0.0.0-latest
4 changes: 2 additions & 2 deletions examples/gno.land/r/gnoland/blog/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/gnoland/blog

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/blog" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/blog v0.0.0-latest
)
6 changes: 3 additions & 3 deletions examples/gno.land/r/gnoland/faucet/gno.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module gno.land/r/gnoland/faucet

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/testutils" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
)
4 changes: 2 additions & 2 deletions examples/gno.land/r/gnoland/pages/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/gnoland/pages

require (
"gno.land/p/demo/avl" v0.0.0-latest
"gno.land/p/demo/blog" v0.0.0-latest
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/blog v0.0.0-latest
)
4 changes: 1 addition & 3 deletions examples/gno.land/r/system/names/gno.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module gno.land/r/system/names

require (
"gno.land/p/demo/avl" v0.0.0-latest
)
require gno.land/p/demo/avl v0.0.0-latest
4 changes: 2 additions & 2 deletions examples/gno.land/r/x/manfred_outfmt/gno.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gno.land/r/x/manfred_outfmt

require (
"gno.land/p/demo/rand" v0.0.0-latest
"gno.land/p/demo/ufmt" v0.0.0-latest
gno.land/p/demo/rand v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
)
Loading

0 comments on commit bc281eb

Please sign in to comment.