Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

fixed trimToImportPath for outside of go path #33

Merged
merged 9 commits into from
May 22, 2019
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 2
jobs:
build-linux-go-1.12:
working_directory: ~/go-ethereum
docker:
- image: circleci/golang:1.12
steps:
Expand All @@ -16,6 +17,7 @@ jobs:
paths:
- "/go/pkg/mod"
tests-linux-go-1.12:
working_directory: ~/go-ethereum
docker:
- image: circleci/golang:1.12
steps:
Expand Down
6 changes: 6 additions & 0 deletions logger/glog/glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ var trimPrefixes = []string{
func trimToImportPath(file string) string {
if root := strings.LastIndex(file, "src/"); root != 0 {
file = file[root+3:]
re := regexp.MustCompile(`^.*\bgo-ethereum\b`)
index := re.FindStringIndex(file)
if index != nil {
file = file[index[1]:]
}
}
return file
}
Expand Down Expand Up @@ -796,6 +801,7 @@ func (l *loggingT) header(s severity, depth int) (*buffer, string, int) {
}
file = file[1:] // drop '/'
}

return l.formatHeader(s, file, line), file, line
}

Expand Down