mirror of
https://github.com/golang/go
synced 2024-11-23 18:30:06 -07:00
cmd/trace: fix static file reference
Use runtime.GOROOT instead of os.Getenv("GOROOT") to reference trace-viewer html file. GOROOT env var is not necessary set, runtime.GOROOT has a default value for such case. Change-Id: I906a720f6822915bd9575756e6cbf6d622857c2b Reviewed-on: https://go-review.googlesource.com/13593 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
5bf1369c9b
commit
e8c4a5b893
@ -10,8 +10,8 @@ import (
|
||||
"internal/trace"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@ -63,7 +63,7 @@ var templTrace = `
|
||||
// httpTraceViewerHTML serves static part of trace-viewer.
|
||||
// This URL is queried from templTrace HTML.
|
||||
func httpTraceViewerHTML(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, filepath.Join(os.Getenv("GOROOT"), "misc", "trace", "trace_viewer_lean.html"))
|
||||
http.ServeFile(w, r, filepath.Join(runtime.GOROOT(), "misc", "trace", "trace_viewer_lean.html"))
|
||||
}
|
||||
|
||||
// httpJsonTrace serves json trace, requested from within templTrace HTML.
|
||||
|
Loading…
Reference in New Issue
Block a user