Commit e8c4a5b8 authored by Dmitry Vyukov's avatar Dmitry Vyukov Committed by Russ Cox

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/13593Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 5bf1369c
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment