15
15
package gen
16
16
17
17
import (
18
- "bytes"
19
- "encoding/json"
20
18
"flag"
21
19
"go/format"
22
20
"io/ioutil"
@@ -25,10 +23,9 @@ import (
25
23
const specURL = `https://raw.githubusercontent.com/qemu/qemu/stable-2.11/qapi-schema.json`
26
24
27
25
var (
28
- inputSpec = flag .String ("input" , specURL , "Input spec" )
29
- outputGo = flag .String ("output" , "" , "Generated code output" )
30
- outputSpec = flag .String ("spec" , "" , "Generated spec output" )
31
- templates = flag .String ("templates" , "" , "Template directory" )
26
+ inputSpec = flag .String ("input" , specURL , "Input spec" )
27
+ outputGo = flag .String ("output" , "" , "Generated code output" )
28
+ templates = flag .String ("templates" , "" , "Template directory" )
32
29
)
33
30
34
31
// Generate parses a QMP API spec and generates a Go implementation.
@@ -40,23 +37,6 @@ func Generate() error {
40
37
return err
41
38
}
42
39
43
- // Write out the concatenated spec.
44
- var spec bytes.Buffer
45
-
46
- // First add a comment with the best guess of version
47
- spec .WriteString ("\n ##QEMU SPECIFICATION VERSION: " )
48
- spec .WriteString (tryGetVersionFromSpecPath (* inputSpec ))
49
- spec .WriteString ("\n \n " )
50
-
51
- for _ , def := range defs {
52
- spec .WriteString (def .Docstring )
53
- spec .WriteByte ('\n' )
54
- json .Indent (& spec , def .JSON , "" , " " )
55
- spec .WriteString ("\n \n " )
56
- }
57
- if err = ioutil .WriteFile (* outputSpec , spec .Bytes (), 0640 ); err != nil {
58
- return err
59
- }
60
40
// Generate and write out the code.
61
41
symbols , err := parse (defs )
62
42
if err != nil {
0 commit comments