-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: normalize paths on windows #74
Conversation
2009645
to
a92dbe3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's very unfortunate that windows needs that!
setup.go
Outdated
@@ -68,7 +68,11 @@ func SetupLogging() { | |||
zapCfg.OutputPaths = []string{"stderr"} | |||
// check if we log to a file | |||
if logfp := os.Getenv(envLoggingFile); len(logfp) > 0 { | |||
zapCfg.OutputPaths = append(zapCfg.OutputPaths, logfp) | |||
if path, err := normalizePath(logfp); err != nil { | |||
fmt.Fprintf(os.Stderr, "error normalizing log path '%q': %s\n", logfp, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should output paths revert to just stderr in this case? that doesn't seem obvious based on the printed error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Yeah, it probably should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, that's what happens. I guess I can just add that to the message.
Fixes #73 by normalizing paths to UNC on windows. This is _slightly_ less hacky than registering a new schema. The underlying issue was twofold: 1. When specifying a windows file URL as `file://c:/foo/bar`, go barfs because `:` can't be in a domain name. 2. When specifying a windows file URL as `file:///c:/foo/bar`, we'd end up trying to open `/c:/foo/bar` which is actually `CURRENT_DRIVE:/c:/foo/bar`.
a92dbe3
to
45b384f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified logging the benchmark tests to file on windows works
Fixes #73 by normalizing paths to UNC on windows. This is slightly less hacky than registering a new schema.
The underlying issue was twofold:
file://c:/foo/bar
, go barfs because:
can't be in a domain name.file:///c:/foo/bar
, we'd end up trying to open/c:/foo/bar
which is actuallyCURRENT_DRIVE:/c:/foo/bar
.