本文整理汇总了Golang中github.com/ubuntu-core/snappy/overlord/snapstate.SnapState.Channel方法的典型用法代码示例。如果您正苦于以下问题:Golang SnapState.Channel方法的具体用法?Golang SnapState.Channel怎么用?Golang SnapState.Channel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/ubuntu-core/snappy/overlord/snapstate.SnapState
的用法示例。
在下文中一共展示了SnapState.Channel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: populateStateFromInstalled
func populateStateFromInstalled() error {
all, err := (&snappy.Overlord{}).Installed()
if err != nil {
return err
}
if osutil.FileExists(dirs.SnapStateFile) {
return fmt.Errorf("cannot create state: state %q already exists", dirs.SnapStateFile)
}
st := state.New(&overlordStateBackend{
path: dirs.SnapStateFile,
})
st.Lock()
defer st.Unlock()
for _, sn := range all {
// no need to do a snapstate.Get() because this is firstboot
info := sn.Info()
var snapst snapstate.SnapState
snapst.Sequence = append(snapst.Sequence, &info.SideInfo)
snapst.Channel = info.Channel
snapst.Active = sn.IsActive()
snapstate.Set(st, sn.Name(), &snapst)
}
return nil
}