From ad69553815fca404382492c80f387eec7597cfd9 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 22 Nov 2021 21:57:27 -0500 Subject: [PATCH] internal/tour: fix go.dev/tour The playground js was coming from godoc instead of the updated copy in go.dev. Change-Id: I26be8634b0e5d453b966be758f08c15b4bc7ca72 Reviewed-on: https://go-review.googlesource.com/c/website/+/366376 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Website-Publish: Russ Cox --- content.go | 5 ++++- internal/tour/tour.go | 10 ++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/content.go b/content.go index 40ea366c..4b8b4475 100644 --- a/content.go +++ b/content.go @@ -23,7 +23,10 @@ func TourOnly() fs.FS { //go:embed _content var embedded embed.FS -//go:embed _content/tour _content/favicon.ico _content/images/go-logo-white.svg +//go:embed _content/favicon.ico +//go:embed _content/images/go-logo-white.svg +//go:embed _content/js/playground.js +//go:embed _content/tour var tourOnly embed.FS func subdir(fsys fs.FS, path string) fs.FS { diff --git a/internal/tour/tour.go b/internal/tour/tour.go index c37fcd09..8806c470 100644 --- a/internal/tour/tour.go +++ b/internal/tour/tour.go @@ -19,7 +19,6 @@ import ( "strings" "time" - "golang.org/x/tools/godoc/static" "golang.org/x/tools/present" "golang.org/x/website" ) @@ -231,14 +230,9 @@ func initScript(mux *http.ServeMux, socketAddr, transport string) error { modTime := time.Now() b := new(bytes.Buffer) - content, ok := static.Files["playground.js"] - if !ok { - return fmt.Errorf("playground.js not found in static files") - } - b.WriteString(content) - // Keep this list in dependency order files := []string{ + "../js/playground.js", "static/lib/jquery.min.js", "static/lib/jquery-ui.min.js", "static/lib/angular.min.js", @@ -253,7 +247,7 @@ func initScript(mux *http.ServeMux, socketAddr, transport string) error { } for _, file := range files { - f, err := fs.ReadFile(contentTour, "tour/"+file) + f, err := fs.ReadFile(contentTour, path.Clean("tour/"+file)) if err != nil { return err }