You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+28-22Lines changed: 28 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,22 +34,22 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc
34
34
- To **re-generate all mocks**, use the command below from the root of the project:
35
35
36
36
```sh
37
-
go generate -run "go.uber.org/mock/mockgen" ./...
37
+
go generate -run mockgen ./...
38
38
```
39
39
40
-
- To **add** an interface that needs a corresponding mock generated:
41
-
-if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
42
-
- modify its `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface (preferred); or
43
-
- add another `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface according to specific mock generation settings
44
-
-if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed):
40
+
* To **add** an interface that needs a corresponding mock generated:
41
+
*if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
42
+
* modify its `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface (preferred); or
43
+
* add another `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface according to specific mock generation settings
44
+
*if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed):
45
45
46
46
```go
47
47
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
48
48
// See the file LICENSE for licensing terms.
49
49
50
50
package mypackage
51
51
52
-
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface
52
+
//go:generate go tool -modfile=tools/go.mod mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface
53
53
```
54
54
55
55
Notes:
@@ -58,22 +58,28 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc
58
58
- To **remove** an interface from having a corresponding mock generated:
59
59
1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined
60
60
1. If the `//go:generate` mockgen command line:
61
-
- generates a mock file for multiple interfaces, remove your interface from the line
62
-
- generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well.
61
+
* generates a mock file for multiple interfaces, remove your interface from the line
62
+
* generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well.
63
63
64
-
## Documentation guidelines
64
+
## Tool Dependencies
65
65
66
-
- Code should be well commented, so it is easier to read and maintain.
67
-
Any complex sections or invariants should be documented explicitly.
68
-
- Code must be documented adhering to the official Go
- Changes that modify a package significantly or add new features should
74
-
either update the existing or include a new `README.md` file in that package.
66
+
This project uses `go tool` to manage development tool dependencies in`tools/go.mod`. This isolates tool dependencies from the main application dependencies and provides consistent, version-locked tools across the team.
75
67
76
-
## Can I have feature X
68
+
### Managing Tools
77
69
78
-
Before you submit a feature request, please check and make sure that it isn't
79
-
possible through some other means.
70
+
* To **add a new tool**:
71
+
```sh
72
+
go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@version
73
+
```
74
+
75
+
* To **upgrade a tool**:
76
+
```sh
77
+
go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@newversion
78
+
```
79
+
80
+
* To **run a tool manually**:
81
+
```sh
82
+
go tool -modfile=tools/go.mod toolname [args...]
83
+
```
84
+
85
+
Note: `ginkgo` remains in the main `go.mod` as it is used directly in e2e test code.
0 commit comments