internal/datasource: don't set Unit.BuildContexts

Now that fetch is setting the build contexts, the DataSource doesn't
have to.

For golang/go#47780

Change-Id: I88b667f9645ad1ee4a94ff62001adf4d17f313ae
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344671
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/internal/datasource/local.go b/internal/datasource/local.go
index 923bb56..29cfb7a 100644
--- a/internal/datasource/local.go
+++ b/internal/datasource/local.go
@@ -74,14 +74,6 @@
 	for _, unit := range m.Units {
 		unit.IsRedistributable = true
 	}
-	for _, unit := range m.Units {
-		for _, d := range unit.Documentation {
-			unit.BuildContexts = append(unit.BuildContexts, internal.BuildContext{
-				GOOS:   d.GOOS,
-				GOARCH: d.GOARCH,
-			})
-		}
-	}
 }
 
 // NewGOPATHModuleGetter returns a module getter that uses the GOPATH
diff --git a/internal/datasource/local_test.go b/internal/datasource/local_test.go
index ffef9ab..9f0ee78 100644
--- a/internal/datasource/local_test.go
+++ b/internal/datasource/local_test.go
@@ -240,16 +240,22 @@
 			got, err := datasource.GetUnit(ctx, um, 0, internal.BuildContext{})
 			if !test.wantLoaded {
 				if err == nil {
-					t.Fatalf("returned not loaded module %q", test.path)
+					t.Fatal("returned not loaded module")
 				}
 				return
 			}
 			if err != nil {
-				t.Fatalf("failed for %q: %q", test.path, err.Error())
+				t.Fatal(err)
 			}
 
 			if gotEmpty := (got.Documentation == nil && got.Readme == nil); gotEmpty {
-				t.Errorf("%q: gotEmpty = %t", test.path, gotEmpty)
+				t.Errorf("gotEmpty = %t", gotEmpty)
+			}
+			if got.Documentation != nil {
+				want := []internal.BuildContext{internal.BuildContextAll}
+				if !cmp.Equal(got.BuildContexts, want) {
+					t.Errorf("got %v, want %v", got.BuildContexts, want)
+				}
 			}
 		})
 	}