Skip to content

Commit 52bcc43

Browse files
committed
fix: include other files in mempkg
Signed-off-by: Norman <norman@samourai.coop>
1 parent 98ccddd commit 52bcc43

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

gnovm/pkg/packages/analyze_packages.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func readPkgDir(pkgDir string, importPath string, fset *token.FileSet) *Package
107107

108108
base := entry.Name()
109109

110-
if !strings.HasSuffix(base, ".gno") {
110+
if !strings.HasSuffix(base, ".gno") && base != "LICENSE" && base != "README.md" {
111111
continue
112112
}
113113

gnovm/pkg/packages/load.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"path/filepath"
99
"slices"
1010
"sort"
11-
"strings"
1211

1312
"github.com/gnolang/gno/gnovm"
1413
"github.com/gnolang/gno/gnovm/pkg/gnoenv"
@@ -227,12 +226,11 @@ func listDepsRecursive(rootTarget *Package, target *Package, pkgs PackagesMap, d
227226
}
228227

229228
func (p *Package) MemPkg() (*gnovm.MemPackage, error) {
229+
// XXX: use gnolang.ReadMemPackageFromList
230+
230231
files := []*gnovm.MemFile{}
231232
for _, cat := range p.Files {
232233
for _, f := range cat {
233-
if !strings.HasSuffix(f, ".gno") {
234-
continue
235-
}
236234
body, err := os.ReadFile(filepath.Join(p.Dir, f))
237235
if err != nil {
238236
return nil, err

gnovm/pkg/packages/pkglist.go

-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ package packages
33
import (
44
"errors"
55
"fmt"
6-
"os"
76
"slices"
87

9-
"github.com/davecgh/go-spew/spew"
108
"github.com/gnolang/gno/gnovm"
119
"github.com/gnolang/gno/gnovm/pkg/gnolang"
1210
)
@@ -137,7 +135,6 @@ func (pl PkgList) GetMemPackage(pkgPath string) *gnovm.MemPackage {
137135
}
138136
memPkg, err := pkg.MemPkg()
139137
if err != nil {
140-
spew.Fdump(os.Stderr, "get err", err)
141138
panic(err)
142139
}
143140
return memPkg

gnovm/pkg/packages/types.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ type Package struct {
1818
Name string `json:",omitempty"` // package name
1919
Root string `json:",omitempty"` // Gno root, Gno path dir, or module root dir containing this package
2020
ModPath string
21-
Match []string `json:",omitempty"` // command-line patterns matching this package
22-
Errors []*Error `json:",omitempty"` // error loading this package (not dependencies)
23-
Draft bool
24-
Files FilesMap
21+
Match []string `json:",omitempty"` // command-line patterns matching this package
22+
Errors []*Error `json:",omitempty"` // error loading this package (not dependencies)
23+
Draft bool `json:",omitempty"`
24+
Files FilesMap `json:",omitempty"`
2525
Imports map[FileKind][]string `json:",omitempty"` // import paths used by this package
2626
Deps []string `json:",omitempty"` // all (recursively) imported dependencies
2727

0 commit comments

Comments
 (0)