how to generate new proto

I am working on pull request to allow the user to have a url to remote machines (or at least experiment if possible).

I made a change to the device configuration option to add bool field in file proto/lib/deviceconfiguration.proto. I thought the command to make it generate the proto file lib/config/deviceconfiguration.pb.go is “go generate ./…” in the root directory.

When I run the command from root, this is the output I get. 2020/09/18 21:17:01 Formatting database.proto repos/protobuf/gogoproto/gogo.proto: File not found. database.proto:11:1: Import “repos/protobuf/gogoproto/gogo.proto” was not found or had errors. cmd/stdiscosrv/database.go:8: running “protoc”: exit status 1 2020/09/18 21:17:03 Formatting structs.proto repos/protobuf/gogoproto/gogo.proto: File not found. lib/protocol/bep.proto:5:1: Import “repos/protobuf/gogoproto/gogo.proto” was not found or had errors. structs.proto:5:1: Import “repos/protobuf/gogoproto/gogo.proto” was not found or had errors. structs.proto:6:1: Import “lib/protocol/bep.proto” was not found or had errors. structs.proto:16:5: “protocol.Vector” is not defined. structs.proto:34:5: “protocol.Vector” is not defined. structs.proto:39:5: “protocol.FileInfoType” is not defined. structs.proto:55:14: “protocol.BlockInfo” is not defined. structs.proto:85:5: “protocol.Vector” is not defined. lib/db/structs.go:8: running “protoc”: exit status 1 2020/09/18 21:17:03 Formatting local.proto repos/protobuf/gogoproto/gogo.proto: File not found. local.proto:5:1: Import “repos/protobuf/gogoproto/gogo.proto” was not found or had errors. lib/discover/local.go:8: running “protoc”: exit status 1 2020/09/18 21:17:03 Formatting deviceid_test.proto repos/protobuf/gogoproto/gogo.proto: File not found. deviceid_test.proto:6:1: Import “repos/protobuf/gogoproto/gogo.proto” was not found or had errors. lib/protocol/deviceid_test.go:4: running “protoc”: exit status 1 stat …/…/…/repos/xdr/cmd/genxdr/main.go: no such file or directory lib/relay/protocol/packets.go:4: running “go”: exit status 1

Any ideas on what the problem is?

There are some dependencies, try go run build.go proto which is the wrapper command.

I called “go run build.go proto” I am getting similar error.

libprotoc 3.13.0

program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--gogofast_out: protoc-gen-gogofast: Plugin failed with status code 1.
lib/db/structs.go:8: running "protoc": exit status 1

I think it has something to do with gopath not being set up correctly. Im taking a look

I think it had something to do with env not being setup. I solved it with this.

I added these to the .bashrc and it work export GOROOT=/usr/local/go export GOPATH=$HOME/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN

@calmh got the command to work, but it had not affect on lib/config/deviceconfiguration.pb.go. Is there another command to get it regenerate the file.

Never mind, it work after I save the file. You must have telepathically told me to save file so thank you :slight_smile: .

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.