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: implement gno mod tidy #1035

Merged
merged 26 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5990795
init `gno mod tidy`
harry-hov Aug 7, 2023
5da6927
Parse and print imports
harry-hov Aug 9, 2023
8e11e5d
Replace existing gno.mod file
harry-hov Aug 15, 2023
dfe5e66
Improvements to WriteToPath()
harry-hov Aug 26, 2023
0853056
fix running from subdirs
harry-hov Aug 26, 2023
d96701f
Add gno mod tidy workflow
harry-hov Sep 11, 2023
3adcfce
Add todo
harry-hov Sep 11, 2023
363c92d
s/WriteToPath/Write
harry-hov Oct 5, 2023
abdeb6c
Remove unused funcs
harry-hov Oct 5, 2023
deb0118
Use gm.AddRequire()
harry-hov Oct 5, 2023
bbd9c7d
Dont look recursive for imports
harry-hov Oct 8, 2023
113c1da
skip if importpath is modulepath
harry-hov Oct 8, 2023
f05f5c8
Run `gno mod tidy`
harry-hov Oct 8, 2023
1724537
TestParseGnoMod
harry-hov Oct 9, 2023
08c68c5
Test `gno mod tidy` command
harry-hov Oct 10, 2023
0767b53
TestGetGnoImports
harry-hov Oct 10, 2023
e0f484e
Merge branch 'master' into hariom/gno-mod-tidy
harry-hov Oct 10, 2023
c9105b4
make fmt
harry-hov Oct 10, 2023
b0ddfdd
Merge branch 'master' into hariom/gno-mod-tidy
harry-hov Oct 11, 2023
c0f19e6
Merge branch 'master' into hariom/gno-mod-tidy
harry-hov Oct 11, 2023
d853f25
add `make tidy`
harry-hov Oct 12, 2023
f747627
Update .github/workflows/examples.yml
harry-hov Oct 12, 2023
e0df6ec
Merge branch 'master' into hariom/gno-mod-tidy
harry-hov Oct 12, 2023
7eb544d
Update examples/Makefile
harry-hov Oct 16, 2023
03638fe
Update .github/workflows/examples.yml
harry-hov Oct 16, 2023
fe81089
Merge branch 'master' into hariom/gno-mod-tidy
harry-hov Oct 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading