// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // The protoc-gen-go binary is a protoc plugin to generate a Go protocol // buffer package. package main import ( "strings" "google.golang.org/proto/protogen" ) func main() { protogen.Run(func(gen *protogen.Plugin) error { for _, f := range gen.Files { if !f.Generate { continue } genFile(gen, f) } return nil }) } func genFile(gen *protogen.Plugin, f *protogen.File) { g := gen.NewGeneratedFile(strings.TrimSuffix(f.Desc.GetName(), ".proto") + ".pb.go") g.P("// Code generated by protoc-gen-go. DO NOT EDIT.") g.P("// source: ", f.Desc.GetName()) g.P() g.P("package TODO") // TODO: Everything. }