Skip to content

Commit

Permalink
cmd/trace: fix static file reference
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dvyukov authored and rsc committed Aug 15, 2015
1 parent 5bf1369 commit e8c4a5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"internal/trace"
"log"
"net/http"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit e8c4a5b

Please sign in to comment.