當前位置: 首頁>>代碼示例>>Golang>>正文


Golang stringset.StringSet類代碼示例

本文整理匯總了Golang中utilz/stringset.StringSet的典型用法代碼示例。如果您正苦於以下問題:Golang StringSet類的具體用法?Golang StringSet怎麽用?Golang StringSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了StringSet類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: External

func (d Dag) External(update bool) {

	var argv []string
	var set *stringset.StringSet
	var i int = 0

	set = d.Alien()

	argv = make([]string, 0)
	argv = append(argv, "go")
	argv = append(argv, "get")

	if global.GetBool("-verbose") {
		argv = append(argv, "-v")
	}

	if update {
		argv = append(argv, "-u")
	}
	argv = append(argv, "-a")

	i = len(argv)
	argv = append(argv, "dummy")

	for u := range set.Iter() {
		argv[i] = u
		if global.GetBool("-dryrun") {
			fmt.Printf("%s || exit 1\n", strings.Join(argv, " "))
		} else {
			say.Printf("go get: %s\n", u)
			handy.StdExecve(argv, true)
		}
	}

}
開發者ID:bjarneh,項目名稱:godag,代碼行數:35,代碼來源:dag.go

示例2: Ready

func (p *Package) Ready(local, compiled *stringset.StringSet) bool {

	for dep := range p.dependencies.Iter() {
		if local.Contains(dep) && !compiled.Contains(dep) {
			return false
		}
	}

	return true
}
開發者ID:emergenesis,項目名稱:godag,代碼行數:10,代碼來源:dag.go

示例3: External

func (d Dag) External() {

	var err os.Error
	var argv []string
	var tmp string
	var set *stringset.StringSet
	var i int = 0

	set = stringset.New()

	for _, v := range d {
		for dep := range v.dependencies.Iter() {
			if !d.localDependency(dep) {
				set.Add(dep)
			}
		}
	}

	for u := range set.Iter() {
		if !seemsExternal(u) {
			set.Remove(u)
		}
	}

	argv = make([]string, 0)

	tmp, err = exec.LookPath("goinstall")

	if err != nil {
		log.Fatalf("[ERROR] %s\n", err)
	}

	argv = append(argv, tmp)

	if global.GetBool("-verbose") {
		argv = append(argv, "-v=true")
	}

	argv = append(argv, "-u=true")
	argv = append(argv, "-clean=true")

	i = len(argv)
	argv = append(argv, "dummy")

	for u := range set.Iter() {
		argv[i] = u
		if global.GetBool("-dryrun") {
			fmt.Printf("%s || exit 1\n", strings.Join(argv, " "))
		} else {
			say.Printf("goinstall: %s\n", u)
			handy.StdExecve(argv, true)
		}
	}

}
開發者ID:ssrl,項目名稱:mgd,代碼行數:55,代碼來源:dag.go

示例4: External

func (d Dag) External() {

	var err os.Error
	var argv []string
	var tmp string
	var set *stringset.StringSet
	var i int = 0

	set = d.Alien()

	argv = make([]string, 0)

	tmp, err = exec.LookPath("goinstall")

	if err != nil {
		log.Fatalf("[ERROR] %s\n", err)
	}

	argv = append(argv, tmp)

	if global.GetBool("-verbose") {
		argv = append(argv, "-v=true")
	}

	argv = append(argv, "-u=true")
	argv = append(argv, "-clean=true")

	i = len(argv)
	argv = append(argv, "dummy")

	for u := range set.Iter() {
		argv[i] = u
		if global.GetBool("-dryrun") {
			fmt.Printf("%s || exit 1\n", strings.Join(argv, " "))
		} else {
			say.Printf("goinstall: %s\n", u)
			handy.StdExecve(argv, true)
		}
	}

}
開發者ID:emergenesis,項目名稱:godag,代碼行數:41,代碼來源:dag.go

示例5: ParallelCompile

func ParallelCompile(pkgs []*dag.Package) {

	var localDeps *stringset.StringSet
	var compiledDeps *stringset.StringSet
	var y, z, count int
	var parallel []*dag.Package
	var oldPkgFound bool = false
	var zeroFirst []*dag.Package

	localDeps = stringset.New()
	compiledDeps = stringset.New()

	for y = 0; y < len(pkgs); y++ {
		localDeps.Add(pkgs[y].Name)
		pkgs[y].ResetIndegree()
	}

	zeroFirst = make([]*dag.Package, len(pkgs))

	for y = 0; y < len(pkgs); y++ {
		if pkgs[y].Indegree == 0 {
			zeroFirst[count] = pkgs[y]
			count++
		}
	}

	for y = 0; y < len(pkgs); y++ {
		if pkgs[y].Indegree > 0 {
			zeroFirst[count] = pkgs[y]
			count++
		}
	}

	parallel = make([]*dag.Package, 0)

	for y = 0; y < len(zeroFirst); {

		if !zeroFirst[y].Ready(localDeps, compiledDeps) {

			oldPkgFound = compileMultipe(parallel, oldPkgFound)

			for z = 0; z < len(parallel); z++ {
				compiledDeps.Add(parallel[z].Name)
			}

			parallel = make([]*dag.Package, 0)

		} else {
			parallel = append(parallel, zeroFirst[y])
			y++
		}
	}

	if len(parallel) > 0 {
		_ = compileMultipe(parallel, oldPkgFound)
	}

}
開發者ID:ssrl,項目名稱:mgd,代碼行數:58,代碼來源:compiler.go


注:本文中的utilz/stringset.StringSet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。