internal/fetch: rename ModuleGetter.FS to ContentDir
For golang/go#47834
Change-Id: I37db9b43e2ab29a65ec5c5e3860ad859cfb5c7cd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/343963
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
diff --git a/internal/fetch/fetch.go b/internal/fetch/fetch.go
index 5eeae8f..16071fb 100644
--- a/internal/fetch/fetch.go
+++ b/internal/fetch/fetch.go
@@ -208,7 +208,7 @@
fr.ResolvedVersion = resolvedVersion
fi.Version = resolvedVersion
} else {
- contentDir, err = mg.FS(ctx, fr.ModulePath, fr.ResolvedVersion)
+ contentDir, err = mg.ContentDir(ctx, fr.ModulePath, fr.ResolvedVersion)
if err != nil {
return fi, err
}
diff --git a/internal/fetch/getters.go b/internal/fetch/getters.go
index f2b9a07..9355ed9 100644
--- a/internal/fetch/getters.go
+++ b/internal/fetch/getters.go
@@ -35,12 +35,12 @@
// Mod returns the contents of the module's go.mod file.
Mod(ctx context.Context, path, version string) ([]byte, error)
- // FS returns an FS for the module's contents. The FS should match the
+ // ContentDir returns an FS for the module's contents. The FS should match the
// format of a module zip file's content directory. That is the
// "<module>@<resolvedVersion>" directory that all module zips are expected
// to have according to the zip archive layout specification at
// https://golang.org/ref/mod#zip-files.
- FS(ctx context.Context, path, version string) (fs.FS, error)
+ ContentDir(ctx context.Context, path, version string) (fs.FS, error)
// ZipSize returns the approximate size of the zip file in bytes.
// It is used only for load-shedding.
@@ -65,9 +65,9 @@
return g.prox.Mod(ctx, path, version)
}
-// FS returns an FS for the module's contents. The FS should match the format
+// ContentDir returns an FS for the module's contents. The FS should match the format
// of a module zip file.
-func (g *proxyModuleGetter) FS(ctx context.Context, path, version string) (fs.FS, error) {
+func (g *proxyModuleGetter) ContentDir(ctx context.Context, path, version string) (fs.FS, error) {
zr, err := g.prox.Zip(ctx, path, version)
if err != nil {
return nil, err
@@ -145,8 +145,8 @@
return data, err
}
-// FS returns an fs.FS for the module.
-func (g *directoryModuleGetter) FS(ctx context.Context, path, version string) (fs.FS, error) {
+// ContentDir returns an fs.FS for the module's contents.
+func (g *directoryModuleGetter) ContentDir(ctx context.Context, path, version string) (fs.FS, error) {
if err := g.checkPath(path); err != nil {
return nil, err
}
@@ -237,9 +237,9 @@
return g.readFile(path, version, "mod")
}
-// FS returns an FS for the module's zip file.
-func (g *fsModuleGetter) FS(ctx context.Context, path, version string) (_ fs.FS, err error) {
- defer derrors.Wrap(&err, "fsModuleGetter.FS(%q, %q)", path, version)
+// ContentDir returns an fs.FS for the module's contents.
+func (g *fsModuleGetter) ContentDir(ctx context.Context, path, version string) (_ fs.FS, err error) {
+ defer derrors.Wrap(&err, "fsModuleGetter.ContentDir(%q, %q)", path, version)
data, err := g.readFile(path, version, "zip")
if err != nil {
diff --git a/internal/fetch/getters_test.go b/internal/fetch/getters_test.go
index 62dcf99..dab3c5f 100644
--- a/internal/fetch/getters_test.go
+++ b/internal/fetch/getters_test.go
@@ -88,8 +88,8 @@
t.Errorf("got %q, want %q", got, want)
}
})
- t.Run("fs", func(t *testing.T) {
- fsys, err := g.FS(ctx, modulePath, version)
+ t.Run("contentdir", func(t *testing.T) {
+ fsys, err := g.ContentDir(ctx, modulePath, version)
if err != nil {
t.Fatal(err)
}