Skip to content
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

Switch to go-winio/tools/mkwinsyscall #1409

Merged
merged 2 commits into from Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion computestorage/storage.go
Expand Up @@ -7,7 +7,7 @@ import (
hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
)

//go:generate go run ../mksyscall_windows.go -output zsyscall_windows.go storage.go
//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go storage.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt even know you could do a go run from a remote. Thats crazy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you try and use $GOROOT/src/syscall/mksyscall_windows.go, it tells you the prefered way golang.org/x/sys/windows/mkwinsyscall

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also did not know..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this actually work for a vendor based project (one that had winio vendored)? I did a quick test of just vendoring x/sys/windows and doing the go:generate dance and specifying golang.org/x/sys/windows/mkwinsyscall, it complains with:
cannot find package "github.com/dcantah/generate/vendor/golang.org/x/sys/windows/mkwinsyscall" in:
C:\Users\danny\go\src\github.com\dcantah\generate\vendor\golang.org\x\sys\windows\mkwinsyscall

which is honestly what I thought would happen, but maybe there's more I'm missing. I don't think we'd ever actually have an import from the tools/mkwinsyscall pkg so mod vendor wouldn't pull in the files afaict.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there is a way to vendor the tool:
https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
I have to wait until upstream go-winio gets updated, since it fails to vendor and update.
I am not sure if Go respects that local copy when building it though...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a shot, it sounds like there is a way though


//sys hcsImportLayer(layerPath string, sourceFolderPath string, layerData string) (hr error) = computestorage.HcsImportLayer?
//sys hcsExportLayer(layerPath string, exportFolderPath string, layerData string, options string) (hr error) = computestorage.HcsExportLayer?
Expand Down
187 changes: 100 additions & 87 deletions computestorage/zsyscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions go.mod
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/BurntSushi/toml v0.4.1
github.com/Microsoft/go-winio v0.5.2
github.com/Microsoft/go-winio v0.6.0
github.com/cenkalti/backoff/v4 v4.1.3
github.com/containerd/cgroups v1.0.3
github.com/containerd/console v1.0.3
Expand All @@ -28,8 +28,8 @@ require (
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f
go.etcd.io/bbolt v1.3.6
go.opencensus.io v0.23.0
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
google.golang.org/grpc v1.47.0
)

Expand Down Expand Up @@ -64,8 +64,10 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.1.0 // indirect
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.12 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down