Skip to content

Commit

Permalink
chore: GetGnoModPath -> ModCachePath
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Meier <[email protected]>
  • Loading branch information
n0izn0iz committed Nov 7, 2024
1 parent d28d54c commit cd5c0c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gnovm/cmd/gno/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func execClean(cfg *cleanCfg, args []string, io commands.IO) error {
}

if cfg.modCache {
modCacheDir := gnomod.GetGnoModPath()
modCacheDir := gnomod.ModCachePath()
if !cfg.dryRun {
if err := os.RemoveAll(modCacheDir); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion gnovm/cmd/gno/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func execModDownload(cfg *modDownloadCfg, args []string, io commands.IO) error {
}

// fetch dependencies
if err := gnoMod.FetchDeps(gnomod.GetGnoModPath(), cfg.remote, cfg.verbose); err != nil {
if err := gnoMod.FetchDeps(gnomod.ModCachePath(), cfg.remote, cfg.verbose); err != nil {
return fmt.Errorf("fetch: %w", err)
}

Expand Down
10 changes: 5 additions & 5 deletions gnovm/pkg/gnomod/gnomod.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ import (

const queryPathFile = "vm/qfile"

// GetGnoModPath returns the path for gno modules
func GetGnoModPath() string {
// ModCachePath returns the path for gno modules
func ModCachePath() string {
return filepath.Join(gnoenv.HomeDir(), "pkg", "mod")
}

// PackageDir resolves a given module.Version to the path on the filesystem.
// If root is dir, it is defaulted to the value of [GetGnoModPath].
// If root is dir, it is defaulted to the value of [ModCachePath].
func PackageDir(root string, v module.Version) string {
// This is also used internally exactly like filepath.Join; but we'll keep
// the calls centralized to make sure we can change the path centrally should
// we start including the module version in the path.

if root == "" {
root = GetGnoModPath()
root = ModCachePath()
}
return filepath.Join(root, v.Path)
}
Expand Down Expand Up @@ -89,7 +89,7 @@ func writePackage(remote, basePath, pkgPath string) (requirements []string, err
func GnoToGoMod(f File) (*File, error) {
// TODO(morgan): good candidate to move to pkg/transpiler.

gnoModPath := GetGnoModPath()
gnoModPath := ModCachePath()

if !gnolang.IsStdlib(f.Module.Mod.Path) {
f.AddModuleStmt(transpiler.TranspileImportPath(f.Module.Mod.Path))
Expand Down

0 comments on commit cd5c0c7

Please sign in to comment.