mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-29 12:17:48 +00:00
5c5b531562
Rename encoding/*pb to follow the convention of prefixing package names with 'proto': google.golang.org/protobuf/encoding/protojson google.golang.org/protobuf/encoding/prototext Move protogen under a compiler/ directory, just in case we ever do add more compiler-related packages. google.golang.org/protobuf/compiler/protogen Change-Id: I31010cb5cabcea8274fffcac468477b58b56e8eb Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177178 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
// 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 (
|
|
"errors"
|
|
"flag"
|
|
|
|
gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo"
|
|
"google.golang.org/protobuf/compiler/protogen"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
flags flag.FlagSet
|
|
plugins = flags.String("plugins", "", "deprecated option")
|
|
importPrefix = flags.String("import_prefix", "", "deprecated option")
|
|
opts = &protogen.Options{
|
|
ParamFunc: flags.Set,
|
|
}
|
|
)
|
|
protogen.Run(opts, func(gen *protogen.Plugin) error {
|
|
if *plugins != "" {
|
|
return errors.New("protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC")
|
|
}
|
|
if *importPrefix != "" {
|
|
return errors.New("protoc-gen-go: import_prefix is not supported")
|
|
}
|
|
for _, f := range gen.Files {
|
|
if f.Generate {
|
|
gengo.GenerateFile(gen, f)
|
|
}
|
|
}
|
|
return nil
|
|
})
|
|
}
|