File tree Expand file tree Collapse file tree 8 files changed +21
-328
lines changed Expand file tree Collapse file tree 8 files changed +21
-328
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ before_script:
29
29
# Install dependencies for testing.
30
30
- go get github.com/golang/mock/gomock@v1.2.0
31
31
- go get github.com/golang/mock/mockgen@v1.2.0
32
+ # Generate the mocks for testing.
33
+ - go generate ./...
32
34
33
35
script :
34
36
- make test
Original file line number Diff line number Diff line change @@ -25,13 +25,8 @@ gofmt_test:
25
25
$(VERB ) echo " Running 'go fmt' test ..."
26
26
$(VERB ) ./gofmt_test.sh
27
27
28
- ghutil_test :
29
- $(VERB ) echo
30
- $(VERB ) echo " Running tests in 'ghutil' recursively ..."
31
- $(VERB ) $(MAKE ) VERBOSE=$(VERBOSE ) -s -C ghutil test
32
-
33
28
go_mod_tidy_test :
34
29
$(VERB ) echo " Running 'go mod tidy' test ..."
35
30
$(VERB ) ./go_mod_tidy_test.sh
36
31
37
- test : go_test gofmt_test ghutil_test go_mod_tidy_test
32
+ test : go_test gofmt_test go_mod_tidy_test
Original file line number Diff line number Diff line change @@ -50,27 +50,26 @@ $ go get github.com/golang/mock/gomock@v1.2.0
50
50
$ go get github.com/golang/mock/mockgen@v1.2.0
51
51
```
52
52
53
+ Generate the mocks:
54
+
55
+ ``` bash
56
+ $ go generate ./...
57
+ ```
58
+
53
59
This specific version of both ` gomock ` and ` mockgen ` tools is what's used in
54
60
this repo, and tests will fail if your version of these tools generates
55
61
different code, including comments.
56
62
57
63
To update the versions of these tools used in this repo:
58
64
59
- 1 . update the version numbers in this file (above) and in
60
- [ ` .travis.yml ` ] ( .travis.yml ) to match
61
- 1 . run the commands above to get those specific versions of the tools
62
- 1 . update the generated code in this repo via:
63
-
64
- ``` bash
65
- $ cd ghutil
66
- $ rm -f mock_ghutil.go
67
- $ make mock
68
- ```
69
-
65
+ 1 . update the version numbers in this file (above) as well as in
66
+ [ ` .travis.yml ` ] ( .travis.yml ) and [ ` go.mod ` ] ( go.mod ) to match
67
+ 1 . run ` go mod tidy ` to update the ` go.sum ` file
68
+ 1 . run the updated ` go get ` commands above to get newer versions of the tools
69
+ 1 . run the ` go generate ` command above to regenerate the mocks
70
70
1 . [ run the tests] ( #testing ) from the top-level of the tree
71
- 1 . commit your changes to this file (` README.md ` ), ` .travis.yml ` , and
72
- ` ghutil/mock_ghutil.go ` and make sure the build passes on Travis CI before
73
- merging the change
71
+ 1 . commit your changes to this file (` README.md ` ) and ` .travis.yml ` , making
72
+ sure that the build passes on Travis CI before merging the change
74
73
75
74
## Testing
76
75
Original file line number Diff line number Diff line change
1
+ mock_ghutil.go
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
+ // TODO(mbrukman): in the future, consider using the recently-added
16
+ // `-copyright_filename` flag: https://github.com/golang/mock/pull/234
17
+
18
+ //go:generate mockgen -source ghutil.go -destination mock_ghutil.go -package ghutil
15
19
package ghutil
16
20
17
21
import (
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments