Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
409b98d6
Commit
409b98d6
authored
Oct 13, 2022
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Update README to describe how to update protobuf compiler and use it
parent
730d7cd8
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!510
Release
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+93
-0
93 additions, 0 deletions
README.md
with
93 additions
and
0 deletions
README.md
+
93
−
0
View file @
409b98d6
...
@@ -404,3 +404,96 @@ You can verify that all symbols got bound by unzipping `bindings-sources.jar` an
...
@@ -404,3 +404,96 @@ You can verify that all symbols got bound by unzipping `bindings-sources.jar` an
Every time you make a change to the client or bindings, you must rebuild the client bindings into a
`.aar`
or
`iOS.zip`
Every time you make a change to the client or bindings, you must rebuild the client bindings into a
`.aar`
or
`iOS.zip`
to propagate those changes to the app. There's a script that runs gomobile for you in the
`bindings-integration`
to propagate those changes to the app. There's a script that runs gomobile for you in the
`bindings-integration`
repository.
repository.
## Regenerate Protobuf File
First install the protobuf compiler or update by following the instructions in
[
Installing Protocol Buffer Compiler
](
#installing-protocol-buffer-compiler
)
below.
Use the following command to compile a protocol buffer.
```
shell
protoc
-I
.
-I
../vendor
--go_out
=
.
--go_opt
=
paths
=
source_relative
--go-grpc_out
=
.
--go-grpc_opt
=
paths
=
source_relative
*
.proto
```
*
This command must be run from the directory containing the
`.proto`
file
being compiled.
*
The
`-I`
flag specifies where to find imports used by the
`.proto`
file and
may need to be modified or removed to suit the .proto file being compiled.
\
*
💡
**Note:**
Note: If you are importing a file from the vendor directory,
ensure that you have the correct version by running
`go mod vendor`
.
*
If there is more than one proto file in the directory, replace
`*.proto`
with
the file’s name.
*
If the
`.proto`
file does not use gRPC, then the
`--go-grpc_out`
and
`--go-grpc_opt`
can be excluded.
## Installing Protocol Buffer Compiler
This guide describes how to install the required dependencies to compile
`.proto`
files to Go.
Before following the instructions below, be sure to remove all old versions of
`protoc`
. If your previous protoc-gen-go file is not installed in your Go bin
directory, it will also need to be removed.
If you have followed this guide previously when installing
`protoc`
and need to
update, you can simply follow the instructions below. No uninstallation or
removal is necessary.
To compile a protocol buffer, you need the protocol buffer compiler
`protoc`
along with two plugins
`protoc-gen-go`
and
`protoc-gen-go-grpc`
. Make sure you
use the correct versions as listed below.
| | Version | Download | Documentation |
|----------------------|--------:|---------------------------------------------------------------------|-------------------------------------------------------------------------|
|
`protoc`
| 3.15.6 | https://github.com/protocolbuffers/protobuf/releases/tag/v3.15.6 | https://developers.google.com/protocol-buffers/docs/gotutorial |
|
`protoc-gen-go`
| 1.27.1 | https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.27.1 | https://pkg.go.dev/google.golang.org/protobuf@v1.27.1/cmd/protoc-gen-go |
|
`protoc-gen-go-grpc`
| 1.2.0 | https://github.com/grpc/grpc-go/releases/tag/v1.2.0 | https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc |
1.
Download the correct release of
`protoc`
from the
[
release page
](
https://github.com/protocolbuffers/protobuf/releases
)
or use
the link from the table above to get the download for your OS.
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip
2.
Extract the files to a folder, such as
`$HOME/.local`
.
unzip protoc-3.15.6-linux-x86_64.zip -d $HOME/.local
3.
Add the selected directory to your environment’s
`PATH`
variable, make sure
to include it in your
`.profile`
or
`.bashrc`
file. Also, include your go bin
directory (
`$GOPATH/bin`
or
`$GOBIN`
) if it is not already included.
export PATH="$PATH:$HOME/.local/bin:$GOPATH/bin"
💡
**Note:**
Make sure you update your configuration file once done with
source
`.profile`
.
4.
Now check that
`protoc`
is installed with the correct version by running the
following command.
protoc --version
Which prints the current version
libprotoc 3.15.6
5.
Next, download
`protoc-gen-go`
and
`protoc-gen-go-grpc`
using the version
found in the table above.
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.27
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
6.
Check that
`protoc-gen-go`
is installed with the correct version.
protoc-gen-go --version
protoc-gen-go v1.27.1
7.
Check that
`protoc-gen-go-grpc`
is installed with the correct version.
protoc-gen-go-grpc --version
protoc-gen-go-grpc 1.2.0
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment