Skip to content

Commit

Permalink
Merge pull request #112 from wking/optional-linux
Browse files Browse the repository at this point in the history
generate: Adjust to Spec.Linux being a pointer
  • Loading branch information
Ma Shimiao authored Dec 20, 2016
2 parents c570fbe + 9004f6d commit f3499f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ func (g *Generator) Spec() *rspec.Spec {
func (g *Generator) Save(w io.Writer, exportOpts ExportOptions) (err error) {
var data []byte

if g.spec.Linux != nil {
buf, err := json.Marshal(g.spec.Linux)
if err != nil {
return err
}
if string(buf) == "{}" {
g.spec.Linux = nil
}
}

if exportOpts.Seccomp {
data, err = json.MarshalIndent(g.spec.Linux.Seccomp, "", "\t")
} else {
Expand Down

0 comments on commit f3499f2

Please sign in to comment.