-
Notifications
You must be signed in to change notification settings - Fork 264
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
Adding build constraints #1340
Adding build constraints #1340
Conversation
Adding windows build constraints to code to allow tests and benchmarks to be run on Linux. Added doc.go to modules (with doc string, where appropriate) to prevent compiler/linter errors about broken imports. In some cases (ie, winapi and wclayer), the package already had an OS-agnostic file of the same name, along with a doc string. A doc.go file was added to preempt situations where windows-specific code is added to that file in the future. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
My hero 😆. Whenever this is out of draft please assign me. |
Renaming files in `test\cri-containerd` to end with `_test.go` so they can include variables and functions defined in other `_test.go`. For example, `gmsa.go` imports `gmsaAccount`, which is defined in `main_test.go`. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
This is going to take a while :) |
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.
LGTM
@@ -0,0 +1,3 @@ | |||
// Package hcn is a shim for the Host Compute Networking (HCN) service, which manages networking for Windows Server | |||
// containers and Hyper-V containers. Previous to RS5, HCN was referred to as Host Networking Service (HNS). |
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.
Nit: Prior*
@@ -1,3 +1,5 @@ | |||
//go:build windows |
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.
[Not blocking this pr in anyway] I can only comment on changed lines, but @katiewasnothere it'd be worth splitting the hcn networking from the ncproxynetworking implementations into _windows and _linux files most likely (at least that's what my memory is telling me the github.com/Microsoft/hcsshim/internal/ncproxy/networking definitions were for).
We also use winio in this file as well for DialPipe
, which I guess on Linux we could use a Unix domain socket instead.
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.
lgtm. Was it just go test./..
that you wanted to unlock with this (or future work)? I think our linux specific tests just amounted to things in /internal/guest (which we run in the build_gcs CI step), unless I'm forgetting some
There's actually a bunch of tests in |
This reverts commit 949e46a. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
* Adding build constraints Adding windows build constraints to code to allow tests and benchmarks to be run on Linux. Added doc.go to modules (with doc string, where appropriate) to prevent compiler/linter errors about broken imports. In some cases (ie, winapi and wclayer), the package already had an OS-agnostic file of the same name, along with a doc string. A doc.go file was added to preempt situations where windows-specific code is added to that file in the future. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> * Renaming test files Renaming files in `test\cri-containerd` to end with `_test.go` so they can include variables and functions defined in other `_test.go`. For example, `gmsa.go` imports `gmsaAccount`, which is defined in `main_test.go`. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
* Adding build constraints Adding windows build constraints to code to allow tests and benchmarks to be run on Linux. Added doc.go to modules (with doc string, where appropriate) to prevent compiler/linter errors about broken imports. In some cases (ie, winapi and wclayer), the package already had an OS-agnostic file of the same name, along with a doc string. A doc.go file was added to preempt situations where windows-specific code is added to that file in the future. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> * Renaming test files Renaming files in `test\cri-containerd` to end with `_test.go` so they can include variables and functions defined in other `_test.go`. For example, `gmsa.go` imports `gmsaAccount`, which is defined in `main_test.go`. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Adding windows build constraints to code to allow tests and benchmarks to be run on Linux, and to limit compiler/linter/language server errors in general about code base.
Now,
go test ./..
will successfully run on both Windows and Linux, and only run the appropriate tests.Added doc.go to modules (with doc string, where appropriate) to prevent compiler/linter errors about broken imports.
(Ie, if an entire package is only available on one OS, then its import statements will error on the other OS since the compiler/language server cannot find any code to satisfy the import.)
In some cases (ie, winapi and wclayer), the package already had an OS-agnostic file of the same name, along with a doc string. A doc.go file was added to preempt situations where windows-specific code is added to that file in the future.
go-winio/pkg/guid was updated to be OS-agnostic, but until the version is updated in go.mod, then
cow/cow.go
,gcs/protocol.gcs
,hcs/schema1/schema1.go
,wclayer/wclayer.go
, andwinapi/devices.go
are restricted to beings Windows specific.Renamed files in
test\cri-containerd
to end with_test.go
so they can include variables and functions defined in other_test.go
. For example,gmsa.go
importsgmsaAccount
, which is defined inmain_test.go
.PR also fixes minor linter issues with extra whitespace and misspelled words.
Signed-off-by: Hamza El-Saawy hamzaelsaawy@microsoft.com