-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
WIP: Windows Support #999
Draft
abhinav
wants to merge
4
commits into
master
Choose a base branch
from
abg/workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WIP: Windows Support #999
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #999 +/- ##
==========================================
- Coverage 98.20% 98.02% -0.19%
==========================================
Files 47 47
Lines 2067 2073 +6
==========================================
+ Hits 2030 2032 +2
- Misses 29 32 +3
- Partials 8 9 +1 ☔ View full report in Codecov by Sentry. |
This was referenced Sep 7, 2021
Merged
abhinav
added a commit
that referenced
this pull request
Sep 10, 2021
Add Go 1.17 to the list of versions we test with. `gofmt` all files to add the new `//go:build` directives meant to replace `// +build`. This supersedes the Go version upgrade in #999. That PR will be narrowed down just to Windows support.
abhinav
force-pushed
the
abg/workflow
branch
from
September 10, 2021 12:43
b9feede
to
6d0a8ef
Compare
abhinav
changed the title
CI: Test with Go 1.16, 1.17 on Windows and Linux
WIP: Windows Support
Sep 10, 2021
abhinav
added a commit
that referenced
this pull request
Sep 10, 2021
Add Go 1.17 to the list of versions we test with. `gofmt` all files to add the new `//go:build` directives meant to replace `// +build`. This supersedes the Go version upgrade in #999. That PR will be narrowed down just to Windows support.
abhinav
force-pushed
the
abg/workflow
branch
from
September 10, 2021 16:27
6d0a8ef
to
c789314
Compare
Update the GitHub workflow configuration to test on both, Linux and Windows.
abhinav
force-pushed
the
abg/workflow
branch
2 times, most recently
from
November 20, 2021 00:16
4911015
to
2f204b0
Compare
We use `newSink` to decide where the zap.Config.OutputPaths field intends to send logs. It can be in the form, file:///foo/bar # or equivalently, /foo/bar Or a user can register a custom sink constructor with `RegisterSink`, and then use the specified scheme in the output paths. zap.RegisterSink("myscheme", ...) zap.Config{ OutputPaths: []string{ "myscheme://whatever/I/want", }, } This method of configuration hasn't worked for Windows (ref #994) because we use `url.Parse` to parse these output paths. `url.Parse` parses a Windows file path like `C:\foo\bar` to the URL: URL{ Scheme: "c", Opaque: `\foo\bar`, } This commit adds support for Windows file paths. It does so by converting "\" symbols in the output path with "/" before attempting to parse it with url.Parse. This gives us, URL{ Scheme: "c", Path: "/foo/bar", } Following that, we check if the scheme matches the path's "volume name". On Windows, the volume name of `C:\foo\bar` is `"C:"`. On Unix, the volume name of all paths is `""`. This lets us convert the partial file path in the URL back to a valid Windows file path and set the scheme to "file" to use the file sink.
abhinav
force-pushed
the
abg/workflow
branch
from
November 20, 2021 00:20
2f204b0
to
82e841b
Compare
If we register a factory with the scheme `m://` on Windows, matching blindly on just the volume name will turn `m://foo/bar` into `file://m:\foo\bar`. We need to do the `file://` conversion only if we didn't find a factory with the name in the path.
`strings.HasPrefix(.., '/')` is Unix specific.
any update? |
abhinav
pushed a commit
that referenced
this pull request
Sep 12, 2022
Ref #994, #1000 Alternate approach to #999, this approach brings absolute path support to Windows. It does so by checking for absolute paths and handling them using the file factory directly. To test different paths without trying to actually open them (UNC paths hit the network), this change also prefactors the sink registry into a separate type that allows stubbing of the `os.OpenFile` call. Note: This change does not bring full Windows support -- many tests still fail, and Windows file URIs don't work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref #1000