1
0
mirror of https://github.com/golang/go synced 2024-11-05 11:46:12 -07:00

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 <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Brad Fitzpatrick 2018-06-27 20:58:43 +00:00
parent 16699b2d33
commit 1c99e1239a

View File

@ -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
}