mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 18:55:18 +01:00
Fix logger line() call if built outside of the repo root
If harbor is built (or `go test`'d) in a different folder than the repo root, the call to common/utils/log/line(...) will panic with an index out of range runtime error because the separator can't find `harbor/src` in the path. Signed-off-by: Nathan Lowe <public@nlowe.me>
This commit is contained in:
parent
893de67eb9
commit
b4e169db26
@ -278,7 +278,7 @@ func line(callDepth int) string {
|
||||
line = 0
|
||||
}
|
||||
l := strings.SplitN(file, srcSeparator, 2)
|
||||
if len(l) > 0 {
|
||||
if len(l) > 1 {
|
||||
file = l[1]
|
||||
}
|
||||
return fmt.Sprintf("[%s:%d]:", file, line)
|
||||
|
Loading…
Reference in New Issue
Block a user