From 1c99e1239a0c8b0e59c34000995c4e319b7702ca Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 27 Jun 2018 20:58:43 +0000 Subject: [PATCH] godoc: default to GOOS/GOARCH js/wasm when rendering syscall/js docs Otherwise it was just blank. With this CL, this URL should start rendering docs: https://tip.golang.org/pkg/syscall/js/ Tested locally. Change-Id: I2d9b7286f374e9372be372987bb5d12ce5044ce9 Reviewed-on: https://go-review.googlesource.com/121315 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Richard Musiol Reviewed-by: Brad Fitzpatrick --- godoc/server.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/godoc/server.go b/godoc/server.go index 9240746d..5562da31 100644 --- a/godoc/server.go +++ b/godoc/server.go @@ -88,6 +88,14 @@ func (h *handlerServer) GetPageInfo(abspath, relpath string, mode PageInfoMode, return ioutil.NopCloser(bytes.NewReader(data)), nil } + // Make the syscall/js package always visible by default. + // It defaults to the host's GOOS/GOARCH, and golang.org's + // linux/amd64 means the wasm syscall/js package was blank. + // And you can't run godoc on js/wasm anyway, so host defaults + // don't make sense here. + if goos == "" && goarch == "" && relpath == "syscall/js" { + goos, goarch = "js", "wasm" + } if goos != "" { ctxt.GOOS = goos }