frostfs-api-go/util/protogen/main.go
Evgenii Stratonikov 03759317ef
Some checks failed
DCO action / DCO (pull_request) Failing after 2m20s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m43s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m50s
Tests and linters / Tests with -race (pull_request) Successful in 3m7s
Tests and linters / Lint (pull_request) Failing after 3m53s
protogen: Initial implementation
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-06 16:56:37 +03:00

35 lines
777 B
Go

package main
import (
"flag"
"fmt"
"os"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/protogen/internal_gengo"
"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 {
internal_gengo.GenerateFile(gen, f)
if *genFuzz {
internal_gengo.GenerateFuzzTests(gen, f)
}
}
return nil
})
}