Skip to content

Commit

Permalink
Remove old writeMetadata func
Browse files Browse the repository at this point in the history
  • Loading branch information
upils committed Sep 19, 2023
1 parent c1053f0 commit 90b7520
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions internal/statemachine/state_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,28 +409,6 @@ func (stateMachine *StateMachine) loadState(partialStateMachine *StateMachine) e
return nil
}

// writeMetadata writes the state machine info to disk. This will be used when resuming a
// partial state machine run
func (stateMachine *StateMachine) writeMetadata() error {
gobfilePath := filepath.Join(stateMachine.stateMachineFlags.WorkDir, "ubuntu-image.gob")
gobfile, err := os.OpenFile(gobfilePath, os.O_CREATE|os.O_WRONLY, 0644)
if err != nil && !os.IsExist(err) {
return fmt.Errorf("error opening metadata file for writing: %s", gobfilePath)
}
defer gobfile.Close()
enc := gob.NewEncoder(gobfile)

// due to https://github.com/golang/go/issues/10415 we need to reset potentially tricky
// fields in the gadget before encoding
if stateMachine.GadgetInfo != nil {
gadget.ResetEnclosingVolumeInStructs(stateMachine.GadgetInfo.Volumes)
}

// no need to check errors, as it will panic if there is one
enc.Encode(stateMachine)
return nil
}

// writeMetadataJSON writes the state machine info to disk, encoded as JSON. This will be used when resuming a
// partial state machine run
func (stateMachine *StateMachine) writeMetadataJSON(metadataFile string) error {
Expand Down

0 comments on commit 90b7520

Please sign in to comment.