Skip to content

Commit

Permalink
godoc: default to GOOS/GOARCH js/wasm when rendering syscall/js docs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bradfitz committed Jun 28, 2018
1 parent 16699b2 commit 1c99e12
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions godoc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 1c99e12

Please sign in to comment.