func ModifyManifest(fn func(*schema.ImageManifest) error, acipath string) error {
	man, err := GetManifest(acipath)
	if err != nil {
		return err
	}
	err = fn(man)
	if err != nil {
		return err
	}
	blob, err := man.MarshalJSON()
	if err != nil {
		return err
	}
	manfile, err := os.OpenFile(path.Join(acipath, aci.ManifestFile),
		os.O_WRONLY|os.O_TRUNC, 0644)
	if err != nil {
		return err
	}
	defer manfile.Close()
	_, err = manfile.Write(blob)
	if err != nil {
		return err
	}
	return nil
}
ModifyManifest will read in the manifest from the untarred ACI stored at
acipath, run the fn function (which is intended to modify the manifest), and
then write the resulting manifest back to the file it was read from.
package util
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"github.com/appc/spec/aci"
	"github.com/appc/spec/schema"
)
func GetManifest(acipath string) (*schema.ImageManifest, error) {
	acifile, err := os.Open(path.Join(acipath, aci.ManifestFile))
	if err != nil {
		return nil, err
	}
	defer acifile.Close()
	manblob, err := ioutil.ReadAll(acifile)
	if err != nil {
		return nil, err
	}
	man := &schema.ImageManifest{}
	err = man.UnmarshalJSON(manblob)
	if err != nil {
		return nil, err
	}
	return man, nil
}