internal/fetch: remove empty-module-path code

An empty module path in fetch won't happen since we made the
DirectoryModuleGetter figure out its module path.

For golang/go#47834

Change-Id: I953ad425c7e13ec4e771f4160870e5ef8f7349ff
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/343960
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 1701169..563ba5b 100644
--- a/internal/fetch/fetch.go
+++ b/internal/fetch/fetch.go
@@ -145,19 +145,6 @@
 }
 
 func fetchModule(ctx context.Context, fr *FetchResult, mg ModuleGetter, sourceClient *source.Client) (*FetchInfo, error) {
-	// If the module path is empty, get it from the go.mod file. This should only happen when fetching
-	// a local module.
-	if fr.ModulePath == "" {
-		goModBytes, err := mg.Mod(ctx, fr.ModulePath, fr.RequestedVersion)
-		if err != nil {
-			return nil, err
-		}
-		fr.ModulePath = modfile.ModulePath(goModBytes)
-		if fr.ModulePath == "" {
-			return nil, fmt.Errorf("go.mod has no module path: %w", derrors.BadModule)
-		}
-	}
-
 	info, err := GetInfo(ctx, fr.ModulePath, fr.RequestedVersion, mg)
 	if err != nil {
 		return nil, err