Skip to content

Commit

Permalink
Update protoc to v4.25.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachard committed Jan 17, 2024
1 parent d16f7c8 commit 112ba33
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
49 changes: 30 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,46 @@ ok github.com/dmachard/go-powerdns-protobuf 2.892s

## Development


Add the proto schema as git submodule

git submodule add https://github.com/PowerDNS/dnsmessage
```bash
git submodule add https://github.com/PowerDNS/dnsmessage
```

Update golang version
Export GOBIN

go mod edit -go=1.20
go mod tidy

Download the latest release of protoc and protoc-gen-go
```bash
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
```

export PROTOC_VER=22.2
export GITHUB_URL=https://github.com/protocolbuffers
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
wget $GITHUB_URL/protobuf/releases/download/v$PROTOC_VER/protoc-$PROTOC_VER-linux-x86_64.zip
unzip protoc-$PROTOC_VER-linux-x86_64.zip
Update golang version

Export GOBIN
```bash
go mod edit -go=1.21
go mod tidy
```

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
Download the latest release of protoc and protoc-gen-go

```bash
export PROTOC_VER=25.2
export GITHUB_URL=https://github.com/protocolbuffers
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
wget $GITHUB_URL/protobuf/releases/download/v$PROTOC_VER/protoc-$PROTOC_VER-linux-x86_64.zip
unzip protoc-$PROTOC_VER-linux-x86_64.zip
```

Edit and past the following line in the dnsmessage.proto

option go_package = "github.com/dmachard/go-powerdns-protobuf;powerdns_protobuf";
```bash
option go_package = "github.com/dmachard/go-powerdns-protobuf;powerdns_protobuf";
```

Generate the golang package

cd dnsmessage/
../bin/protoc --proto_path=. --go_out=../ --go_opt=paths=source_relative --plugin protoc-gen-go=${GOBIN}/protoc-gen-go dnsmessage.proto
```bash
cd dnsmessage/
../bin/protoc --proto_path=. --go_out=../ --go_opt=paths=source_relative --plugin protoc-gen-go=${GOBIN}/protoc-gen-go dnsmessage.proto
```
4 changes: 2 additions & 2 deletions dnsmessage.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/dmachard/go-powerdns-protobuf

go 1.20
go 1.21

require google.golang.org/protobuf v1.32.0
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=

0 comments on commit 112ba33

Please sign in to comment.