当前位置: 首页>>代码示例>>Golang>>正文


Golang BuildLabel.String方法代码示例

本文整理汇总了Golang中core.BuildLabel.String方法的典型用法代码示例。如果您正苦于以下问题:Golang BuildLabel.String方法的具体用法?Golang BuildLabel.String怎么用?Golang BuildLabel.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.BuildLabel的用法示例。


在下文中一共展示了BuildLabel.String方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: DiffGraphs

// DiffGraphs calculates the differences between two graphs.
func DiffGraphs(before, after *query.JSONGraph, changedFiles, include, exclude []string, recurse bool) []core.BuildLabel {
	changedFileMap := toMap(changedFiles)
	allChanges := map[string]bool{}
	for pkgName, afterPkg := range after.Packages {
		beforePkg, present := before.Packages[pkgName]
		if !present {
			// Package didn't exist before, add every target in it.
			for targetName := range afterPkg.Targets {
				label := core.BuildLabel{PackageName: pkgName, Name: targetName}
				allChanges[label.String()] = true
			}
			continue
		}
		for targetName, afterTarget := range afterPkg.Targets {
			beforeTarget := beforePkg.Targets[targetName]
			if targetChanged(&beforeTarget, &afterTarget, pkgName, changedFileMap) {
				label := core.BuildLabel{PackageName: pkgName, Name: targetName}
				allChanges[label.String()] = true
			}
		}
	}
	// Now we have all the targets that are directly changed, we locate all transitive ones
	// in a second pass. We can't do this above because we've got no sensible ordering for it.
	ret := core.BuildLabels{}
	for pkgName, pkg := range after.Packages {
		for targetName, target := range pkg.Targets {
			if depsChanged(after, allChanges, pkgName, targetName, recurse) &&
				shouldInclude(&target, include, exclude) {
				ret = append(ret, core.BuildLabel{PackageName: pkgName, Name: targetName})
			}
		}
	}
	sort.Sort(ret)
	return ret
}
开发者ID:thought-machine,项目名称:please,代码行数:36,代码来源:plz_diff_graphs.go

示例2: updateTarget

func updateTarget(state *core.BuildState, plainOutput bool, buildingTarget *buildingTarget, label core.BuildLabel,
	active bool, failed bool, cached bool, description string, err error, colour string) {
	updateTarget2(buildingTarget, label, active, failed, cached, description, err, colour)
	if plainOutput {
		if failed {
			log.Errorf("%s: %s", label.String(), description)
		} else {
			if !active {
				active := pluralise(state.NumActive(), "task", "tasks")
				log.Notice("[%d/%s] %s: %s [%3.1fs]", state.NumDone(), active, label.String(), description, time.Now().Sub(buildingTarget.Started).Seconds())
			} else {
				log.Info("%s: %s", label.String(), description)
			}
		}
	}
}
开发者ID:thought-machine,项目名称:please,代码行数:16,代码来源:shell_output.go


注:本文中的core.BuildLabel.String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。