How to compile this file, I modified the proto, run go:generate, but I found that the pb.go file cannot be generated

How to compile this file, I modified the proto, run go:generate, but I found that the pb.go file cannot be generated.

protoc-gen-gogofaster and protoc-gen-gosyncthing have been installed。

╭─facebook at FaceBook的MacBook Pro in ~/go/src/ on main✘✘✘ using

╰─± pwd /Users/facebook/go/src/

╰─± go env





GOENV="/Users/facebook/Library/Application Support/go/env"




What did you try and what happened?

I try to add an new ignore_path field in folderconfiguration.proto and then recompile to generate folderconfiguration.pb.go

You haven’t shown any commands you run or output from those commands, so I have no idea what you’re doing or what problem you’re experiencing. Be more explicit.

Run the following commands:

//go:generate go run generate.go lib/protocol lib/config lib/fs lib/db lib/discover

2022/06/07 21:37:07 lib/protocol returned: [lib/protocol/bep.proto 
repos/protobuf/gogoproto/gogo.proto: File not found.
lib/protocol/bep.proto:6:1: Import "repos/protobuf/gogoproto/gogo.proto" was not found or had errors.
lib/protocol/bep.proto:5:1: warning: Import ext.proto but not used.
2022/06/07 21:37:07 Failed generatinglib/protocol
exit status 1
generate.go:27: running "go": exit status 1

Yeah don’t do that. Go to the root of the repo and run go run build.go proto to regenerate.

Thank you very much。相当的感谢!!!

That code is a bit obsolete, we could now instead use go list -m -f {{.Dir}} to get the path to the module, which already has the right version and is downloaded.

Actually I have another question, that is I want to change the .stignore file location. Why would I want to do this because I don’t want the sync files to be in a folder with the .stignore file. I’m not very familiar with syncthing code, just watching the stage. I would like to know if you can put the .stignore file in the specified location?

The filename and location of .stignore are currently hard-coded. You can find it easily if you search through the files in the Syncthing repository for “stignore”. Changing the name to something else would be trivial, but moving the file to a completely different location (e.g. outside the Syncthing folder) probably not so much.

Although, I think you could possibly hack the path to place the file inside .stfolder or something for your personal use (without considering backward compatibility, migration from older versions, and the fact that .stfolder itself is configurable and can be a file or even non-existent instead of always being a folder).

1 Like

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