Skip to content

Commit

Permalink
fix: keep ordering
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Jan 30, 2024
1 parent 8d1848f commit 6a119c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gno.land/pkg/integration/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
// -- # Load a package `./bar` from the current testscript's working directory with the name `gno.land/r/foobar/bar`:
// -- use gno.land/r/foobar/bar $WORK/bar
// - If the path is not prefixed with the working directory, it is assumed to be relative to the examples directory.
// - The command should always be executed before `gnoland start` to ensure loading
// - It's important to note that the load order is significant when using
// multiple use command; packages should be loaded in the order they are
// dependent upon.
//
// Logging:
//
Expand Down
9 changes: 9 additions & 0 deletions gno.land/pkg/integration/testing_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,15 @@ func (pkgs pkgsLoader) loadPackages(modroot string, path, name string) error {
return nil // skip draft package
}

// if no require pkgs are declared, use previous one to keep load order
// XXX: find a better way to achieve this
if len(pkg.Requires) == 0 {
pkg.Requires = make([]string, 0, len(pkgs))
for name := range pkgs {
pkg.Requires = append(pkg.Requires, name)
}
}

if _, ok := pkgs[pkg.Name]; ok {
return nil // we already know this pkg
}
Expand Down

0 comments on commit 6a119c6

Please sign in to comment.