// openSnapFile opens a snap blob returning both a snap.Info completed // with sideInfo (if not nil) and a corresponding snap.File. func openSnapFile(snapPath string, unsignedOk bool, sideInfo *snap.SideInfo) (*snap.Info, snap.File, error) { // TODO: what precautions to take if unsignedOk == false ? snapf, err := snap.Open(snapPath) if err != nil { return nil, nil, err } info, err := snapf.Info() if err != nil { return nil, nil, err } var snapInfo snap.Info snapInfo = *info if sideInfo != nil { snapInfo.SideInfo = *sideInfo } return &snapInfo, snapf, nil }