Skip to content

Commit

Permalink
Export and use precompile constants
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-hov committed Mar 17, 2023
1 parent e6d1e14 commit b65aa34
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkgs/gnolang/gnomod/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (f *File) FetchDeps(path string, remote string) error {
continue
}
// skip if `std`, special case.
if path == "github.com/gnolang/gno/stdlibs/stdshim" {
if path == gnolang.GnoStdPkgAfter {
continue
}

Expand Down
12 changes: 6 additions & 6 deletions pkgs/gnolang/gnomod/gnomod.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ func GnoToGoMod(f File) (*File, error) {
return nil, err
}

if strings.HasPrefix(f.Module.Mod.Path, "gno.land/r/") ||
strings.HasPrefix(f.Module.Mod.Path, "gno.land/p/demo/") {
f.Module.Mod.Path = "github.com/gnolang/gno/examples/" + f.Module.Mod.Path
if strings.HasPrefix(f.Module.Mod.Path, gnolang.GnoRealmPkgsPrefixBefore) ||
strings.HasPrefix(f.Module.Mod.Path, gnolang.GnoPackagePrefixBefore) {
f.Module.Mod.Path = gnolang.ImportPrefix + "/examples/" + f.Module.Mod.Path
}

for i := range f.Require {
Expand All @@ -95,9 +95,9 @@ func GnoToGoMod(f File) (*File, error) {
}
}
path := f.Require[i].Mod.Path
if strings.HasPrefix(f.Require[i].Mod.Path, "gno.land/r/") ||
strings.HasPrefix(f.Require[i].Mod.Path, "gno.land/p/demo/") {
f.Require[i].Mod.Path = "github.com/gnolang/gno/examples/" + f.Require[i].Mod.Path
if strings.HasPrefix(f.Require[i].Mod.Path, gnolang.GnoRealmPkgsPrefixBefore) ||
strings.HasPrefix(f.Require[i].Mod.Path, gnolang.GnoPackagePrefixBefore) {
f.Require[i].Mod.Path = gnolang.ImportPrefix + "/examples/" + f.Require[i].Mod.Path
}

f.Replace = append(f.Replace, &modfile.Replace{
Expand Down
12 changes: 6 additions & 6 deletions pkgs/gnolang/precompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
)

const (
gnoRealmPkgsPrefixBefore = "gno.land/r/"
gnoRealmPkgsPrefixAfter = "github.com/gnolang/gno/examples/gno.land/r/"
gnoPackagePrefixBefore = "gno.land/p/demo/"
gnoPackagePrefixAfter = "github.com/gnolang/gno/examples/gno.land/p/demo/"
gnoStdPkgBefore = "std"
gnoStdPkgAfter = "github.com/gnolang/gno/stdlibs/stdshim"
GnoRealmPkgsPrefixBefore = "gno.land/r/"
GnoRealmPkgsPrefixAfter = "github.com/gnolang/gno/examples/gno.land/r/"
GnoPackagePrefixBefore = "gno.land/p/demo/"
GnoPackagePrefixAfter = "github.com/gnolang/gno/examples/gno.land/p/demo/"
GnoStdPkgBefore = "std"
GnoStdPkgAfter = "github.com/gnolang/gno/stdlibs/stdshim"
)

var stdlibWhitelist = []string{
Expand Down

0 comments on commit b65aa34

Please sign in to comment.