From 7eee4ef8c3dbf10decc70e96d3feacbcd201368f Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 11 Jul 2017 13:51:20 +0100 Subject: [PATCH] Tag all files as being for Windows only. This prevents e.g. go guru when running on a different platform tripping over these files even when the build tags are correctly set. In my case this was the case on the github.com/containerd/containerd code base due to hcsshim being vendored there. I must confess to a small naughtiness which is that since I was unable to run mksyscall_windows on my Linux machine I have hand edited both the generator and the generated file. --- activatelayer.go | 2 ++ baselayer.go | 2 ++ callback.go | 2 ++ cgo.go | 2 ++ container.go | 2 ++ createlayer.go | 2 ++ createsandboxlayer.go | 2 ++ deactivatelayer.go | 2 ++ destroylayer.go | 2 ++ errors.go | 2 ++ expandsandboxsize.go | 2 ++ exportlayer.go | 2 ++ getlayermountpath.go | 2 ++ getsharedbaseimages.go | 2 ++ guid.go | 2 ++ hcsshim.go | 2 ++ hnsendpoint.go | 2 ++ hnsfuncs.go | 2 ++ hnsnetwork.go | 2 ++ hnspolicy.go | 2 ++ hnspolicylist.go | 2 ++ importlayer.go | 2 ++ interface.go | 2 ++ layerexists.go | 2 ++ layerutils.go | 2 ++ legacy.go | 2 ++ mksyscall_windows.go | 1 + nametoguid.go | 2 ++ preparelayer.go | 2 ++ process.go | 2 ++ processimage.go | 2 ++ unpreparelayer.go | 2 ++ utils.go | 2 ++ version.go | 2 ++ waithelper.go | 2 ++ zhcsshim.go | 2 ++ 36 files changed, 71 insertions(+) diff --git a/activatelayer.go b/activatelayer.go index efc4d8029c..4468300296 100644 --- a/activatelayer.go +++ b/activatelayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/baselayer.go b/baselayer.go index 9babd4e18a..d93beb7af5 100644 --- a/baselayer.go +++ b/baselayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/callback.go b/callback.go index e8c2b00c8a..fe6ae1937c 100644 --- a/callback.go +++ b/callback.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/cgo.go b/cgo.go index 2003332330..9b192ff87e 100644 --- a/cgo.go +++ b/cgo.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "C" diff --git a/container.go b/container.go index 8bc7d6d2b7..b9db7751ca 100644 --- a/container.go +++ b/container.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/createlayer.go b/createlayer.go index 9ecffb1cb0..bf44f978c0 100644 --- a/createlayer.go +++ b/createlayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/createsandboxlayer.go b/createsandboxlayer.go index b69c3da368..2d8a3e1d81 100644 --- a/createsandboxlayer.go +++ b/createsandboxlayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/deactivatelayer.go b/deactivatelayer.go index c02bcb3a0b..ac91861f45 100644 --- a/deactivatelayer.go +++ b/deactivatelayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/destroylayer.go b/destroylayer.go index 91ed269eef..ef82d955d7 100644 --- a/destroylayer.go +++ b/destroylayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/errors.go b/errors.go index d2f9cc8bd2..25f1c0ee77 100644 --- a/errors.go +++ b/errors.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/expandsandboxsize.go b/expandsandboxsize.go index e168921841..2b418b3620 100644 --- a/expandsandboxsize.go +++ b/expandsandboxsize.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/exportlayer.go b/exportlayer.go index 3c9b24ea6b..8dd8e19485 100644 --- a/exportlayer.go +++ b/exportlayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/getlayermountpath.go b/getlayermountpath.go index 41b5758926..be4cb3d2da 100644 --- a/getlayermountpath.go +++ b/getlayermountpath.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/getsharedbaseimages.go b/getsharedbaseimages.go index 01ab4da3dd..a0e6b9ac8f 100644 --- a/getsharedbaseimages.go +++ b/getsharedbaseimages.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/guid.go b/guid.go index 620aba123c..e55e309a16 100644 --- a/guid.go +++ b/guid.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/hcsshim.go b/hcsshim.go index 3cb3a299ff..91675e7806 100644 --- a/hcsshim.go +++ b/hcsshim.go @@ -1,3 +1,5 @@ +// +build windows + // Shim for the Host Compute Service (HCS) to manage Windows Server // containers and Hyper-V containers. diff --git a/hnsendpoint.go b/hnsendpoint.go index 5c8aa223dd..19c1126c01 100644 --- a/hnsendpoint.go +++ b/hnsendpoint.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/hnsfuncs.go b/hnsfuncs.go index aa29903cd4..89f573a96f 100644 --- a/hnsfuncs.go +++ b/hnsfuncs.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/hnsnetwork.go b/hnsnetwork.go index 319a5dccd0..1b1835891f 100644 --- a/hnsnetwork.go +++ b/hnsnetwork.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/hnspolicy.go b/hnspolicy.go index ecfbf0eda3..64db51247d 100644 --- a/hnspolicy.go +++ b/hnspolicy.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim // Type of Request Support in ModifySystem diff --git a/hnspolicylist.go b/hnspolicylist.go index b6926ae152..199a7942a8 100644 --- a/hnspolicylist.go +++ b/hnspolicylist.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/importlayer.go b/importlayer.go index 75dcd94777..9deaee9243 100644 --- a/importlayer.go +++ b/importlayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/interface.go b/interface.go index f40b88f164..efa0a3c108 100644 --- a/interface.go +++ b/interface.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/layerexists.go b/layerexists.go index 522d95cce4..de655025ac 100644 --- a/layerexists.go +++ b/layerexists.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/layerutils.go b/layerutils.go index 47229d22e5..eb16772005 100644 --- a/layerutils.go +++ b/layerutils.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim // This file contains utility functions to support storage (graph) related diff --git a/legacy.go b/legacy.go index 85761573ca..9672cd83aa 100644 --- a/legacy.go +++ b/legacy.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/mksyscall_windows.go b/mksyscall_windows.go index 82393ca367..2109769860 100644 --- a/mksyscall_windows.go +++ b/mksyscall_windows.go @@ -842,6 +842,7 @@ func main() { // TODO: use println instead to print in the following template const srcTemplate = ` +// +build windows {{define "main"}}// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT diff --git a/nametoguid.go b/nametoguid.go index 1a522f95e0..40ca3b7e49 100644 --- a/nametoguid.go +++ b/nametoguid.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/preparelayer.go b/preparelayer.go index 2791683467..cf2af79264 100644 --- a/preparelayer.go +++ b/preparelayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/process.go b/process.go index 4ef0ed3e52..04a1bb8536 100644 --- a/process.go +++ b/process.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/processimage.go b/processimage.go index fadb1b92c5..9141a0049a 100644 --- a/processimage.go +++ b/processimage.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "os" diff --git a/unpreparelayer.go b/unpreparelayer.go index d0ead0bdda..2194e8bcbf 100644 --- a/unpreparelayer.go +++ b/unpreparelayer.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import "github.com/Sirupsen/logrus" diff --git a/utils.go b/utils.go index bd6e2d94ab..a0c9097c84 100644 --- a/utils.go +++ b/utils.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/version.go b/version.go index ae10c23d42..59d017b951 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim // IsTP4 returns whether the currently running Windows build is at least TP4. diff --git a/waithelper.go b/waithelper.go index 828d148e58..ec30e0b0d7 100644 --- a/waithelper.go +++ b/waithelper.go @@ -1,3 +1,5 @@ +// +build windows + package hcsshim import ( diff --git a/zhcsshim.go b/zhcsshim.go index 5d1a851ae8..01362ce383 100644 --- a/zhcsshim.go +++ b/zhcsshim.go @@ -1,3 +1,5 @@ +// +build windows + // MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT package hcsshim