File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ var generateCmd = &cobra.Command{
66
66
panic (err )
67
67
}
68
68
69
- if err := gen .Gen (mf , p ); err != nil {
69
+ if err := gen .Gen (mf , p , true ); err != nil {
70
70
panic (err )
71
71
}
72
72
},
Original file line number Diff line number Diff line change @@ -21,12 +21,14 @@ type generator struct {
21
21
// used to generate mypy stubs from proto data
22
22
23
23
// Gen writes a mypy type stub to w, generated from the data in p
24
- func Gen (w io.Writer , p * protostub.ProtoData ) error {
24
+ func Gen (w io.Writer , p * protostub.ProtoData , header bool ) error {
25
25
gen := & generator {0 , bufio .NewWriter (w )}
26
26
27
- gen .bw .WriteString (fmt .Sprintf ("# Generated by protostub on %s\n " , time .Now ().Format ("Mon Jan 2 15:04:05 -0700 MST 2006" )))
28
- gen .bw .WriteString ("# https://github.com/arachnys/protostub\n " )
29
- gen .bw .WriteString ("# Do not modify\n " )
27
+ if header {
28
+ gen .bw .WriteString (fmt .Sprintf ("# Generated by protostub on %s\n " , time .Now ().Format ("Mon Jan 2 15:04:05 -0700 MST 2006" )))
29
+ gen .bw .WriteString ("# https://github.com/arachnys/protostub\n " )
30
+ gen .bw .WriteString ("# Do not modify\n " )
31
+ }
30
32
31
33
for _ , i := range p .Types {
32
34
if err := gen .gen (i ); err != nil {
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func TestGeneration(t *testing.T) {
54
54
55
55
buf := bytes .NewBuffer (nil )
56
56
57
- if err := gen .Gen (buf , p ); err != nil {
57
+ if err := gen .Gen (buf , p , false ); err != nil {
58
58
t .Fatal (err )
59
59
}
60
60
You can’t perform that action at this time.
0 commit comments