-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
49 lines (46 loc) · 2.34 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright © 2019 The Things Network Foundation, distributed under the MIT license (see LICENSE file)
package main
import (
"github.com/gogo/protobuf/gogoproto"
"github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
"github.com/gogo/protobuf/vanity"
"github.com/gogo/protobuf/vanity/command"
)
func main() {
req := command.Read()
files := vanity.FilterFiles(req.GetProtoFile(), vanity.NotGoogleProtobufDescriptorProto)
for _, opt := range []func(*descriptor.FileDescriptorProto){
vanity.SetBoolFileOption(gogoproto.E_BenchgenAll, false),
vanity.SetBoolFileOption(gogoproto.E_CompareAll, false),
vanity.SetBoolFileOption(gogoproto.E_DescriptionAll, false),
vanity.SetBoolFileOption(gogoproto.E_EnumStringerAll, true),
vanity.SetBoolFileOption(gogoproto.E_EnumdeclAll, true),
vanity.SetBoolFileOption(gogoproto.E_EqualAll, true),
vanity.SetBoolFileOption(gogoproto.E_FaceAll, false),
vanity.SetBoolFileOption(gogoproto.E_GogoprotoImport, true),
vanity.SetBoolFileOption(gogoproto.E_GoprotoEnumPrefixAll, true),
vanity.SetBoolFileOption(gogoproto.E_GoprotoEnumStringerAll, false),
vanity.SetBoolFileOption(gogoproto.E_GoprotoExtensionsMapAll, true),
vanity.SetBoolFileOption(gogoproto.E_GoprotoGettersAll, true),
vanity.SetBoolFileOption(gogoproto.E_GoprotoRegistration, true),
vanity.SetBoolFileOption(gogoproto.E_GoprotoStringerAll, false),
vanity.SetBoolFileOption(gogoproto.E_GoprotoUnrecognizedAll, false),
vanity.SetBoolFileOption(gogoproto.E_GostringAll, false),
vanity.SetBoolFileOption(gogoproto.E_MarshalerAll, true),
vanity.SetBoolFileOption(gogoproto.E_OnlyoneAll, false),
vanity.SetBoolFileOption(gogoproto.E_PopulateAll, true),
vanity.SetBoolFileOption(gogoproto.E_ProtosizerAll, false),
vanity.SetBoolFileOption(gogoproto.E_SizerAll, true),
vanity.SetBoolFileOption(gogoproto.E_StableMarshalerAll, false),
vanity.SetBoolFileOption(gogoproto.E_StringerAll, true),
vanity.SetBoolFileOption(gogoproto.E_TestgenAll, false),
vanity.SetBoolFileOption(gogoproto.E_TypedeclAll, true),
vanity.SetBoolFileOption(gogoproto.E_UnmarshalerAll, true),
vanity.SetBoolFileOption(gogoproto.E_UnsafeMarshalerAll, false),
vanity.SetBoolFileOption(gogoproto.E_UnsafeUnmarshalerAll, false),
vanity.SetBoolFileOption(gogoproto.E_VerboseEqualAll, false),
} {
vanity.ForEachFile(files, opt)
}
command.Write(command.Generate(req))
}