Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/containerd-shim-runhcs-v1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const usage = ``
const ttrpcAddressEnv = "TTRPC_ADDRESS"

// Add a manifest to get proper Windows version detection.
//go:generate go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific
//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific

// `-ldflags '-X ...'` only works if the variable is uninitialized or set to a constant value.
// keep empty and override with data from [internal/version] only if empty to allow
Expand Down
2 changes: 1 addition & 1 deletion cmd/runhcs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

// Add a manifest to get proper Windows version detection.
//go:generate go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific
//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific

// `-ldflags '-X ...'` only works if the variable is uninitialized or set to a constant value.
// keep empty and override with data from [internal/version] only if empty to allow
Expand Down
2 changes: 1 addition & 1 deletion cmd/wclayer/wclayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

// Add a manifest to get proper Windows version detection.
//go:generate go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific
//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific

var usage = `Windows Container layer utility

Expand Down
2 changes: 1 addition & 1 deletion computestorage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
)

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go storage.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go storage.go

//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
27 changes: 24 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ module github.com/Microsoft/hcsshim

go 1.24.0

// protobuf/gRPC/ttrpc generation
tool (
github.com/containerd/protobuild
github.com/containerd/protobuild/cmd/go-fix-acronym
github.com/containerd/ttrpc/cmd/protoc-gen-go-ttrpc
google.golang.org/grpc/cmd/protoc-gen-go-grpc
google.golang.org/protobuf/cmd/protoc-gen-go
)

// used in go:generate directives
tool (
// generate Win32 API code
github.com/Microsoft/go-winio/tools/mkwinsyscall

// create syso files for manifesting
github.com/josephspurrier/goversioninfo/cmd/goversioninfo

// mock gRPC client and servers
go.uber.org/mock/mockgen
)

require (
github.com/Microsoft/cosesign1go v1.4.0
github.com/Microsoft/didx509go v0.0.3
Expand All @@ -16,12 +37,10 @@ require (
github.com/containerd/errdefs/pkg v0.3.0
github.com/containerd/go-runc v1.1.0
github.com/containerd/platforms v1.0.0-rc.1
github.com/containerd/protobuild v0.3.0
github.com/containerd/ttrpc v1.2.7
github.com/containerd/typeurl/v2 v2.2.3
github.com/google/go-cmp v0.7.0
github.com/google/go-containerregistry v0.20.1
github.com/josephspurrier/goversioninfo v1.5.0
github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422
github.com/mattn/go-shellwords v1.0.12
github.com/moby/sys/user v0.4.0
Expand All @@ -43,7 +62,6 @@ require (
golang.org/x/sync v0.16.0
golang.org/x/sys v0.39.0
google.golang.org/grpc v1.75.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1
google.golang.org/protobuf v1.36.7
)

Expand All @@ -59,6 +77,7 @@ require (
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/plugin v1.0.0 // indirect
github.com/containerd/protobuild v0.3.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
Expand All @@ -81,6 +100,7 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/josephspurrier/goversioninfo v1.5.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
Expand Down Expand Up @@ -124,6 +144,7 @@ require (
golang.org/x/text v0.28.0 // indirect
golang.org/x/tools v0.36.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Expand Down
2 changes: 1 addition & 1 deletion hcn/hcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/Microsoft/go-winio/pkg/guid"
)

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go hcn.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go hcn.go

/// HNS V1 API

Expand Down
2 changes: 1 addition & 1 deletion hcsshim.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/Microsoft/hcsshim/internal/hcserror"
)

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go hcsshim.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go hcsshim.go

//sys SetCurrentThreadCompartmentId(compartmentId uint32) (hr error) = iphlpapi.SetCurrentThreadCompartmentId

Expand Down
2 changes: 1 addition & 1 deletion internal/computeagent/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
// used for ncproxy.
package computeagent

//go:generate go run go.uber.org/mock/mockgen -source=computeagent_ttrpc.pb.go -package=computeagent_mock -destination=mock\computeagent_mock.pb.go
//go:generate go tool go.uber.org/mock/mockgen -source=computeagent_ttrpc.pb.go -package=computeagent_mock -destination=mock\computeagent_mock.pb.go
2 changes: 1 addition & 1 deletion internal/hns/hns.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package hns

import "fmt"

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go hns.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go hns.go

//sys _hnsCall(method string, path string, object string, response **uint16) (hr error) = vmcompute.HNSCall?

Expand Down
2 changes: 1 addition & 1 deletion internal/interop/interop.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"unsafe"
)

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go interop.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go interop.go

//sys coTaskMemFree(buffer unsafe.Pointer) = api_ms_win_core_com_l1_1_0.CoTaskMemFree

Expand Down
2 changes: 1 addition & 1 deletion internal/regstate/regstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"golang.org/x/sys/windows/registry"
)

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go regstate.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go regstate.go

//sys regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) = advapi32.RegCreateKeyExW

Expand Down
2 changes: 1 addition & 1 deletion internal/security/syscall_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package security

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go syscall_windows.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go syscall_windows.go

//sys getSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, ppsidOwner **uintptr, ppsidGroup **uintptr, ppDacl *uintptr, ppSacl *uintptr, ppSecurityDescriptor *uintptr) (win32err error) = advapi32.GetSecurityInfo
//sys setSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, psidOwner uintptr, psidGroup uintptr, pDacl uintptr, pSacl uintptr) (win32err error) = advapi32.SetSecurityInfo
Expand Down
2 changes: 1 addition & 1 deletion internal/vmcompute/vmcompute.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/Microsoft/hcsshim/internal/timeout"
)

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go vmcompute.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go vmcompute.go

//sys hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) = vmcompute.HcsEnumerateComputeSystems?
//sys hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *HcsSystem, result **uint16) (hr error) = vmcompute.HcsCreateComputeSystem?
Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/wclayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package wclayer

import "github.com/Microsoft/go-winio/pkg/guid"

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go wclayer.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go wclayer.go

//sys activateLayer(info *driverInfo, id string) (hr error) = vmcompute.ActivateLayer?
//sys copyLayer(info *driverInfo, srcId string, dstId string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.CopyLayer?
Expand Down
2 changes: 1 addition & 1 deletion internal/winapi/winapi.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package winapi

//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go ./*.go
//go:generate go tool github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go ./*.go
2 changes: 1 addition & 1 deletion pkg/ncproxy/nodenetsvc/v0/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package v0

//go:generate go run go.uber.org/mock/mockgen -source=nodenetsvc_grpc.pb.go -package=nodenetsvc_v0_mock -destination=mock\nodenetsvc_mock.pb.go
//go:generate go tool go.uber.org/mock/mockgen -source=nodenetsvc_grpc.pb.go -package=nodenetsvc_v0_mock -destination=mock\nodenetsvc_mock.pb.go
2 changes: 1 addition & 1 deletion pkg/ncproxy/nodenetsvc/v1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
// used for ncproxy.
package v1

//go:generate go run go.uber.org/mock/mockgen -source=nodenetsvc_grpc.pb.go -package=nodenetsvc_v1_mock -destination=mock\nodenetsvc_mock.pb.go
//go:generate go tool go.uber.org/mock/mockgen -source=nodenetsvc_grpc.pb.go -package=nodenetsvc_v1_mock -destination=mock\nodenetsvc_mock.pb.go
7 changes: 6 additions & 1 deletion scripts/Update-Proto.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ function run([string]$cmd, [string[]]$params) {

# Install protobuild and co.
# calling `go install` without a version will install current module (ie., the vendor directory)
# this relies on `./tools.go` to vendor correct dependencies
# this relies on go.mod tool directives to vendor correct dependencies
#
# Note: we cannot use `go tool <cmd>` to install them since it builds the binaries in a temp dir and
# they, therefore, are not available from $PATH.
#
# See: https://go.dev/ref/mod#go-mod-file-tool
@(
'github.com/containerd/protobuild',
'github.com/containerd/protobuild/cmd/go-fix-acronym',
Expand Down
5 changes: 4 additions & 1 deletion test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ module github.com/Microsoft/hcsshim/test

go 1.24.0

// create syso files for manifesting
tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo

require (
github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29
github.com/Microsoft/hcsshim v0.13.0
Expand All @@ -14,7 +17,6 @@ require (
github.com/containerd/ttrpc v1.2.7
github.com/google/go-cmp v0.7.0
github.com/google/go-containerregistry v0.20.1
github.com/josephspurrier/goversioninfo v1.5.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.1
github.com/opencontainers/runtime-spec v1.2.1
Expand Down Expand Up @@ -71,6 +73,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/josephspurrier/goversioninfo v1.5.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
Expand Down
2 changes: 1 addition & 1 deletion test/pkg/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
// This package allows tests can include the .syso to manifest them to pick up the right Windows build
package manifest

//go:generate go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific
//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -platform-specific
8 changes: 0 additions & 8 deletions test/tools.go

This file was deleted.

22 changes: 0 additions & 22 deletions tools/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions tools/tools.go

This file was deleted.