diff --git a/pkgs/gnolang/gnomod/file.go b/pkgs/gnolang/gnomod/file.go index 948de88bbd2..9b97bd2e587 100644 --- a/pkgs/gnolang/gnomod/file.go +++ b/pkgs/gnolang/gnomod/file.go @@ -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 } diff --git a/pkgs/gnolang/gnomod/gnomod.go b/pkgs/gnolang/gnomod/gnomod.go index 4413ee88d3a..d47e91398f0 100644 --- a/pkgs/gnolang/gnomod/gnomod.go +++ b/pkgs/gnolang/gnomod/gnomod.go @@ -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 { @@ -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{ diff --git a/pkgs/gnolang/precompile.go b/pkgs/gnolang/precompile.go index 3a4e2016a0c..00a4cc7e8c4 100644 --- a/pkgs/gnolang/precompile.go +++ b/pkgs/gnolang/precompile.go @@ -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{