tangs b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
..
BUILD.bazel b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
LICENSE b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
Makefile b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
README.md b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
comment.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
enum.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
extensions.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
field.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
go.mod b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
group.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
import.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
message.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
oneof.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
option.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
package.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
parser.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
proto.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
range.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
reserved.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
service.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
syntax.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
token.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
visitor.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos
walk.go b030ce89ca openbilibili %!s(int64=5) %!d(string=hai) anos

README.md

proto

Build Status Go Report Card GoDoc

Package in Go for parsing Google Protocol Buffers .proto files version 2 + 3

install

go get -u -v github.com/emicklei/proto

usage

package main

import (
    "fmt"
    "os"

    "github.com/emicklei/proto"
)

func main() {
    reader, _ := os.Open("test.proto")
    defer reader.Close()

    parser := proto.NewParser(reader)
    definition, _ := parser.Parse()

    proto.Walk(definition,
        proto.WithService(handleService),
        proto.WithMessage(handleMessage))
}

func handleService(s *proto.Service) {
    fmt.Println(s.Name)
}

func handleMessage(m *proto.Message) {
    fmt.Println(m.Name)
}

contributions

See (https://github.com/emicklei/proto-contrib) for other contributions on top of this package such as protofmt, proto2xsd and proto2gql.

© 2017, ernestmicklei.com. MIT License. Contributions welcome.