Skip to content

Commit

Permalink
glog: use strings.TrimSuffix
Browse files Browse the repository at this point in the history
This was raised in #53.

cl/514318873 (google-internal)
  • Loading branch information
chressie authored and stapelberg committed Mar 17, 2023
1 parent 115d1f9 commit 2cef961
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions glog_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ func (f *verboseFlags) levelForPC(pc uintptr) Level {
file, _ := fn.FileLine(pc)
// The file is something like /a/b/c/d.go. We want just the d for
// regular matches, /a/b/c/d for full matches.
if strings.HasSuffix(file, ".go") {
file = file[:len(file)-3]
}
file = strings.TrimSuffix(file, ".go")
full := file
if slash := strings.LastIndex(file, "/"); slash >= 0 {
file = file[slash+1:]
Expand Down

0 comments on commit 2cef961

Please sign in to comment.