2022-04-08 07:24:46 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-04-25 12:13:10 +00:00
|
|
|
"flag"
|
2022-04-08 07:24:46 +00:00
|
|
|
|
2024-04-25 12:13:10 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/protogen/internalgengo"
|
2022-04-08 07:24:46 +00:00
|
|
|
"google.golang.org/protobuf/compiler/protogen"
|
2024-07-15 08:16:29 +00:00
|
|
|
)
|
|
|
|
|
2022-04-08 07:24:46 +00:00
|
|
|
func main() {
|
2024-04-25 12:13:10 +00:00
|
|
|
var flags flag.FlagSet
|
|
|
|
genFuzz := flags.Bool("fuzz", false, "generate fuzz tests")
|
|
|
|
|
|
|
|
protogen.Options{
|
|
|
|
ParamFunc: flags.Set,
|
|
|
|
}.Run(func(gen *protogen.Plugin) error {
|
2022-04-08 07:24:46 +00:00
|
|
|
for _, f := range gen.Files {
|
2024-08-09 07:19:37 +00:00
|
|
|
if f.Generate {
|
2024-04-25 12:13:10 +00:00
|
|
|
internalgengo.GenerateFile(gen, f)
|
|
|
|
if *genFuzz {
|
|
|
|
internalgengo.GenerateFuzzTests(gen, f)
|
|
|
|
}
|
2022-04-08 07:24:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
}
|