Skip to content

Commit

Permalink
Version control and vendor mockgen (#1802)
Browse files Browse the repository at this point in the history
Explicitly track `github.com/golang/mock/mockgen` as a go dependency.
(There is no change in our go.mod or go.sum, since the package is
already being used by the generated code and elsewhere).

Add `//go:generate` directives to create the mocked files and ensure the
results are always up to date.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
(cherry picked from commit 61e0112)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
  • Loading branch information
helsaawy authored and kiashok committed Oct 13, 2023
1 parent fabb1a3 commit ad5f5af
Show file tree
Hide file tree
Showing 39 changed files with 23,265 additions and 10 deletions.
6 changes: 2 additions & 4 deletions internal/computeagent/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
//
// A mock service under `mock` is used for unit testing the various services
// used for ncproxy.
//
// The mock service is compiled using the following command:
//
// mockgen -source="computeagent.pb.go" -package="computeagent_mock" > mock\computeagent_mock.pb.go
package computeagent

//go:generate go run github.com/golang/mock/mockgen -source=computeagent.pb.go -package=computeagent_mock -destination=mock\computeagent_mock.pb.go
7 changes: 2 additions & 5 deletions pkg/ncproxy/nodenetsvc/v1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
//
// A mock service under `mock` is used for unit testing the various services
// used for ncproxy.
//
// The mock service is compiled using the following command:
//
// mockgen -source="nodenetsvc.pb.go" -package="nodenetsvc_mock" > mock\nodenetsvc_mock.pb.go

package v1

//go:generate go run github.com/golang/mock/mockgen -source=nodenetsvc.pb.go -package=nodenetsvc_v1_mock -destination=mock\nodenetsvc_mock.pb.go
1 change: 1 addition & 0 deletions test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ require (
github.com/godbus/dbus/v5 v5.0.6 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions test/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down
10 changes: 9 additions & 1 deletion tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@

package hcsshim

import _ "github.com/Microsoft/go-winio/tools/mkwinsyscall"
import (
// for go generate directives

// generate Win32 API code
_ "github.com/Microsoft/go-winio/tools/mkwinsyscall"

// mock gRPC client and servers
_ "github.com/golang/mock/mockgen"
)
Loading

0 comments on commit ad5f5af

Please sign in to comment.