forked from TrueCloudLab/frostfs-api-go
37 lines
802 B
Go
37 lines
802 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/protogen/internalgengo"
|
|
"google.golang.org/protobuf/compiler/protogen"
|
|
)
|
|
|
|
func main() {
|
|
var flags flag.FlagSet
|
|
genFuzz := flags.Bool("fuzz", false, "generate fuzz tests")
|
|
yamlConfigPath := flags.String("config", "", "path to the configuration")
|
|
|
|
protogen.Options{
|
|
ParamFunc: flags.Set,
|
|
}.Run(func(gen *protogen.Plugin) error {
|
|
if *yamlConfigPath != "" {
|
|
s, e := os.Getwd()
|
|
fmt.Fprintln(os.Stderr, s, e)
|
|
data, err := os.ReadFile(*yamlConfigPath)
|
|
fmt.Fprintln(os.Stderr, string(data), err)
|
|
}
|
|
|
|
for _, f := range gen.Files {
|
|
if f.Generate {
|
|
internalgengo.GenerateFile(gen, f)
|
|
if *genFuzz {
|
|
internalgengo.GenerateFuzzTests(gen, f)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
})
|
|
}
|