Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anjmao/go2proto
Generate protobuf messages from go structs
https://github.com/anjmao/go2proto
Last synced: 12 days ago
JSON representation
Generate protobuf messages from go structs
- Host: GitHub
- URL: https://github.com/anjmao/go2proto
- Owner: anjmao
- License: mit
- Created: 2019-03-20T12:34:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-02T17:21:20.000Z (over 1 year ago)
- Last Synced: 2024-06-19T00:27:37.535Z (5 months ago)
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 75
- Watchers: 2
- Forks: 24
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# go2proto
Generate Protobuf messages from given go structs. No RPC, not gogo syntax, just pure Protobuf messages.
### Syntax
```
-f string
Protobuf output file path. (default ".")
-filter string
Filter by struct names. Case insensitive.
-p value
Fully qualified path of packages to analyse. Relative paths ("./example/in") are allowed.
```### Example
Your package you wish to export must be inside of your working directory. Package paths can be fully-qualified or relative.
```sh
GO111MODULE=off go get -u github.com/anjmao/go2proto
cd ~/go/src/github.com/anjmao/go2proto
go2proto -f ./example/out -p ./example/in
```### Note
Generated code may not be perfect but since it just 180 lines of code you are free to adapt it for your needs.