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: README.md
+34-5Lines changed: 34 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,16 +105,45 @@ Some of the CT Go code is autogenerated from other files:
105
105
definitions are converted to `.pb.go` implementations.
106
106
- A mock implementation of the Trillian gRPC API (in `trillian/mockclient`) is
107
107
created with [GoMock](https://github.com/golang/mock).
108
+
- Some enums have string-conversion methods (satisfying the `fmt.Stringer`
109
+
interface) created using the
110
+
[stringer](https://godoc.org/golang.org/x/tools/cmd/stringer) tool (`go get
111
+
golang.org/x/tools/cmd/stringer`).
108
112
109
113
Re-generating mock or protobuffer files is only needed if you're changing
110
-
the original files; if you do, you'll need to install the prerequisites:
114
+
the original files. The recommended way to do this is by using the Docker
115
+
image used by the Cloud Build:
111
116
112
-
- tools written in `go` can be installed with a single run of `go install`
113
-
(courtesy of [`tools.go`](./tools/tools.go) and `go.mod`).
114
-
-`protoc` tool: you'll need [version 3.20.1](https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.1) installed, and `PATH` updated to include its `bin/` directory.
docker run -it --mount type=bind,src="$(pwd)",target=/src ctgo-builder /bin/bash -c "cd /src; ./scripts/install_deps.sh; go generate -x ./..."
120
+
```
121
+
122
+
These commands first create a docker image from the Dockerfile in this repo, and
123
+
then launch a container based on this image with the local directory mounted. The
124
+
correct versions of the tools are determined using the `go.mod` file in this repo,
125
+
and these tools are installed. Finally, all of the generated files are regenerated
126
+
and Docker exits.
127
+
128
+
Alternatively, you can install the prerequisites locally:
115
129
116
-
With tools installed, run the following:
130
+
- a series of tools, using `go install` to ensure that the versions are
131
+
compatible and tested:
132
+
133
+
```
134
+
cd $(go list -f '{{ .Dir }}' github.com/google/certificate-transparency-go); \
135
+
go install github.com/golang/mock/mockgen; \
136
+
go install google.golang.org/protobuf/proto; \
137
+
go install google.golang.org/protobuf/cmd/protoc-gen-go; \
138
+
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc; \
139
+
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc; \
140
+
go install golang.org/x/tools/cmd/stringer
141
+
```
142
+
- `protoc` tool: you'll need [version 3.20.1](https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.1) installed, and `PATH` updated to include its `bin/` directory.
143
+
144
+
and run the following:
117
145
118
146
```bash
119
147
go generate -x ./... # hunts for //go:generate comments and runs them
0 commit comments