Skip to content

Commit 779dd20

Browse files
authored
[tooling] Update to use go tool for mockgen and canoto (#4479)
1 parent 8ebe57a commit 779dd20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+60
-65
lines changed

Taskfile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ tasks:
118118
desc: Generates testing mocks
119119
cmds:
120120
- cmd: grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm
121-
- cmd: go generate -run "go.uber.org/mock/mockgen" ./...
121+
- cmd: go generate -run "mockgen" ./...
122122

123123
generate-canoto:
124124
desc: Generates canoto
125-
cmd: go generate -run "github.com/StephenButtolph/canoto/canoto" ./...
125+
cmd: go generate -run "canoto" ./...
126126

127127
generate-load-contract-bindings:
128128
desc: Generates load contract bindings

chains/atomic/mocks_generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
package atomic
55

6-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/shared_memory.go -mock_names=SharedMemory=SharedMemory . SharedMemory
6+
//go:generate go tool mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/shared_memory.go -mock_names=SharedMemory=SharedMemory . SharedMemory

codec/mocks_generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
package codec
55

6-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/manager.go -mock_names=Manager=Manager . Manager
6+
//go:generate go tool mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/manager.go -mock_names=Manager=Manager . Manager

database/mocks_generate_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
package database
55

6-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/batch.go -mock_names=Batch=Batch . Batch
7-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/iterator.go -mock_names=Iterator=Iterator . Iterator
6+
//go:generate go tool mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/batch.go -mock_names=Batch=Batch . Batch
7+
//go:generate go tool mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/iterator.go -mock_names=Iterator=Iterator . Iterator

go.mod

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ require (
6969
go.uber.org/zap v1.27.0
7070
golang.org/x/crypto v0.43.0
7171
golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e
72-
golang.org/x/mod v0.29.0
7372
golang.org/x/net v0.46.0
7473
golang.org/x/sync v0.17.0
7574
golang.org/x/term v0.36.0
@@ -186,6 +185,7 @@ require (
186185
go.opentelemetry.io/otel/metric v1.37.0 // indirect
187186
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
188187
go.uber.org/multierr v1.11.0 // indirect
188+
golang.org/x/mod v0.29.0 // indirect
189189
golang.org/x/oauth2 v0.30.0 // indirect
190190
golang.org/x/sys v0.37.0 // indirect
191191
golang.org/x/text v0.30.0 // indirect
@@ -199,4 +199,8 @@ require (
199199
sigs.k8s.io/yaml v1.3.0 // indirect
200200
)
201201

202-
tool github.com/onsi/ginkgo/v2/ginkgo
202+
tool (
203+
github.com/StephenButtolph/canoto/canoto
204+
github.com/onsi/ginkgo/v2/ginkgo
205+
go.uber.org/mock/mockgen
206+
)

message/mocks_generate_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
package message
55

6-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/outbound_message.go -mock_names=OutboundMessage=OutboundMessage . OutboundMessage
7-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/outbound_message_builder.go -mock_names=OutboundMsgBuilder=OutboundMsgBuilder . OutboundMsgBuilder
6+
//go:generate go tool mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/outbound_message.go -mock_names=OutboundMessage=OutboundMessage . OutboundMessage
7+
//go:generate go tool mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/outbound_message_builder.go -mock_names=OutboundMsgBuilder=OutboundMsgBuilder . OutboundMsgBuilder

simplex/block.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
package simplex
55

6-
//go:generate go run github.com/StephenButtolph/canoto/canoto $GOFILE
6+
//go:generate go tool canoto $GOFILE
77

88
import (
99
"context"

simplex/qc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
package simplex
55

6-
//go:generate go run github.com/StephenButtolph/canoto/canoto $GOFILE
6+
//go:generate go tool canoto $GOFILE
77

88
import (
99
"bytes"

simplex/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
package simplex
55

6-
//go:generate go run github.com/StephenButtolph/canoto/canoto $GOFILE
6+
//go:generate go tool canoto $GOFILE
77

88
import (
99
"context"

snow/consensus/snowman/mocks_generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
package snowman
55

6-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/block.go -mock_names=Block=Block . Block
6+
//go:generate go tool mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/block.go -mock_names=Block=Block . Block

0 commit comments

Comments
 (0)