本文整理匯總了Golang中v/io/jiri.X.Clone方法的典型用法代碼示例。如果您正苦於以下問題:Golang X.Clone方法的具體用法?Golang X.Clone怎麽用?Golang X.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類v/io/jiri.X
的用法示例。
在下文中一共展示了X.Clone方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newmapInput
func newmapInput(jirix *jiri.X, state *project.ProjectState, key project.ProjectKey, index, total int) *mapInput {
return &mapInput{
ProjectState: state,
key: key,
jirix: jirix.Clone(tool.ContextOpts{}),
index: index,
total: total,
}
}
示例2: GetProjectStates
func GetProjectStates(jirix *jiri.X, checkDirty bool) (map[ProjectKey]*ProjectState, error) {
projects, err := LocalProjects(jirix, FastScan)
if err != nil {
return nil, err
}
states := make(map[ProjectKey]*ProjectState, len(projects))
sem := make(chan error, len(projects))
for key, project := range projects {
state := &ProjectState{
Project: project,
}
states[key] = state
// jirix is not threadsafe, so we make a clone for each goroutine.
go setProjectState(jirix.Clone(tool.ContextOpts{}), state, checkDirty, sem)
}
for _ = range projects {
err := <-sem
if err != nil {
return nil, err
}
}
return states, nil
}