Skip to content

Commit 98ccddd

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

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

gnovm/pkg/packages/filekind.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ const (
2424
FileKindTest = "Test"
2525
FileKindXTest = "XTest"
2626
FileKindFiletest = "Filetest"
27+
FileKindOther = "Other"
2728
)
2829

29-
func AllFileKinds() []FileKind {
30+
func GnoFileKinds() []FileKind {
3031
return []FileKind{FileKindPackageSource, FileKindTest, FileKindXTest, FileKindFiletest}
3132
}
3233

3334
// GetFileKind analyzes a file's name and body to get it's [FileKind], fset is optional
3435
func GetFileKind(filename string, body string, fset *token.FileSet) (FileKind, error) {
36+
if filename == "LICENSE" || filename == "README.md" {
37+
return FileKindOther, nil
38+
}
39+
3540
if !strings.HasSuffix(filename, ".gno") {
3641
return FileKindUnknown, fmt.Errorf("%s:1:1: not a gno file", filename)
3742
}

gnovm/pkg/packages/imports.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (imap ImportsMap) ToStrings() map[FileKind][]string {
9797
// Merge merges imports, it removes duplicates and sorts the result
9898
func (imap ImportsMap) Merge(kinds ...FileKind) []*FileImport {
9999
if len(kinds) == 0 {
100-
kinds = AllFileKinds()
100+
kinds = GnoFileKinds()
101101
}
102102

103103
res := make([]*FileImport, 0, 16)

gnovm/pkg/packages/types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ type FilesMap map[FileKind][]string
9797

9898
func (fm FilesMap) Size() int {
9999
total := 0
100-
for _, kind := range AllFileKinds() {
100+
for _, kind := range GnoFileKinds() {
101101
total += len(fm[kind])
102102
}
103103
return total

0 commit comments

Comments
 (0)