Skip to content

Commit 94188a7

Browse files
committed
[patch] change line trace path style for direct url linking"
Signed-off-by: kpango <[email protected]>
1 parent c808ee6 commit 94188a7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

glg.go

+11
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,17 @@ func (g *Glg) out(level LEVEL, format string, val ...interface{}) error {
868868
fl += "/" + path
869869
}
870870
fl += "#L" + strconv.Itoa(line)
871+
case strings.Contains(file, "go/src"):
872+
fl = "https:/"
873+
cnt := 0
874+
for _, path := range strings.Split(strings.SplitN(file, "go/src/", 2)[1], "/") {
875+
if cnt == 3 {
876+
path = "blob/master/" + path
877+
}
878+
fl += "/" + path
879+
cnt++
880+
}
881+
fl += "#L" + strconv.Itoa(line)
871882
default:
872883
fl = file + ":" + strconv.Itoa(line)
873884
}

0 commit comments

Comments
 (0)