diff options
| author | Hana Kim <hyangah@gmail.com> | 2026-03-05 22:43:54 -0500 |
|---|---|---|
| committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | 2026-03-13 09:52:32 -0700 |
| commit | 566bd52e69321d9c76510ff62dd80308dca387a0 (patch) | |
| tree | 567744047f10c021d0d0f1a30ad323c5592b9523 | |
| parent | e408491544ed69282906282ee1a1d294ecce5722 (diff) | |
| download | go-x-pkgsite-566bd52e69321d9c76510ff62dd80308dca387a0.tar.xz | |
all: fix fmtappendf
Change-Id: I80655ec771398304bd5c33c3f8d52ae22a35e6d8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753421
Reviewed-by: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
| -rw-r--r-- | internal/fetch/getters.go | 4 | ||||
| -rw-r--r-- | internal/fetch/latest.go | 2 |
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 { |
