Skip to content

Commit f3499f2

Browse files
author
Ma Shimiao
authored
Merge pull request #112 from wking/optional-linux
generate: Adjust to Spec.Linux being a pointer
2 parents c570fbe + 9004f6d commit f3499f2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

generate/generate.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,16 @@ func (g *Generator) Spec() *rspec.Spec {
196196
func (g *Generator) Save(w io.Writer, exportOpts ExportOptions) (err error) {
197197
var data []byte
198198

199+
if g.spec.Linux != nil {
200+
buf, err := json.Marshal(g.spec.Linux)
201+
if err != nil {
202+
return err
203+
}
204+
if string(buf) == "{}" {
205+
g.spec.Linux = nil
206+
}
207+
}
208+
199209
if exportOpts.Seccomp {
200210
data, err = json.MarshalIndent(g.spec.Linux.Seccomp, "", "\t")
201211
} else {

0 commit comments

Comments
 (0)