Debian Codegraph @

proto/fixtures/generate/main.go

raw
1 package main
2
3 import (
4 "os"
5
6 "github.com/golang/protobuf/proto"
7 "github.com/segmentio/encoding/proto/fixtures"
8 )
9
10 func main() {
11 os.Mkdir("protobuf", 0o755)
12
13 tests := []struct {
14 name string
15 value fixtures.Message
16 }{
17 {
18 name: "message.pb",
19 value: fixtures.Message{
20 A: 10,
21 B: 20,
22 C: 30,
23 D: "Hello World!",
24 },
25 },
26 }
27
28 for _, test := range tests {
29 b, _ := proto.Marshal(&test.value)
30 os.WriteFile("protobuf/"+test.name, b, 0o644)
31 }
32 }