aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/fetch/getters.go4
-rw-r--r--internal/fetch/latest.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/internal/fetch/getters.go b/internal/fetch/getters.go
index f95dada6..89b9fc08 100644
--- a/internal/fetch/getters.go
+++ b/internal/fetch/getters.go
@@ -190,7 +190,7 @@ func (g *directoryModuleGetter) Mod(ctx context.Context, path, version string) (
}
data, err := os.ReadFile(filepath.Join(g.dir, "go.mod"))
if errors.Is(err, os.ErrNotExist) {
- return []byte(fmt.Sprintf("module %s\n", g.modulePath)), nil
+ return fmt.Appendf(nil, "module %s\n", g.modulePath), nil
}
return data, err
}
@@ -433,7 +433,7 @@ func (g *goPackagesModuleGetter) Mod(ctx context.Context, modulePath, version st
}
data, err := os.ReadFile(filepath.Join(m.Dir, "go.mod"))
if errors.Is(err, os.ErrNotExist) {
- return []byte(fmt.Sprintf("module %s\n", modulePath)), nil
+ return fmt.Appendf(nil, "module %s\n", modulePath), nil
}
return data, err
}
diff --git a/internal/fetch/latest.go b/internal/fetch/latest.go
index 9466511d..72b4ce02 100644
--- a/internal/fetch/latest.go
+++ b/internal/fetch/latest.go
@@ -125,7 +125,7 @@ func LatestModuleVersions(ctx context.Context, modulePath string, prox *proxy.Cl
// Something's wrong with the go.mod file, so assume a minimal one instead of failing.
log.Warningf(ctx, "proxy.Mod(%q, %q): %v; using minimal go.mod for latest version info",
modulePath, rawLatest)
- modBytes = []byte(fmt.Sprintf("module %s", modulePath))
+ modBytes = fmt.Appendf(nil, "module %s", modulePath)
}
lmv, err := internal.NewLatestModuleVersions(modulePath, rawLatest, "", "", modBytes)
if err != nil {