Skip to content

Commit 2cef961

Browse files
chressiestapelberg
authored andcommitted
glog: use strings.TrimSuffix
This was raised in #53. cl/514318873 (google-internal)
1 parent 115d1f9 commit 2cef961

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

glog_flags.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ func (f *verboseFlags) levelForPC(pc uintptr) Level {
192192
file, _ := fn.FileLine(pc)
193193
// The file is something like /a/b/c/d.go. We want just the d for
194194
// regular matches, /a/b/c/d for full matches.
195-
if strings.HasSuffix(file, ".go") {
196-
file = file[:len(file)-3]
197-
}
195+
file = strings.TrimSuffix(file, ".go")
198196
full := file
199197
if slash := strings.LastIndex(file, "/"); slash >= 0 {
200198
file = file[slash+1:]

0 commit comments

Comments
 (0)