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


Golang SourceUnit.ID2方法代码示例

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


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

示例1: checkSourceUnitFiles

// checkSourceUnitFiles warns if any files appear in graph data but
// are not in u.Files.
func (s *indexedTreeStore) checkSourceUnitFiles(u *unit.SourceUnit, data graph.Output) {
	if u == nil {
		return
	}

	graphFiles := make(map[string]struct{}, len(u.Files))
	for _, def := range data.Defs {
		graphFiles[def.File] = struct{}{}
	}
	for _, ref := range data.Refs {
		graphFiles[ref.File] = struct{}{}
	}
	for _, doc := range data.Docs {
		graphFiles[doc.File] = struct{}{}
	}
	for _, ann := range data.Anns {
		graphFiles[ann.File] = struct{}{}
	}
	delete(graphFiles, "")

	unitFiles := make(map[string]struct{}, len(u.Files))
	for _, f := range u.Files {
		unitFiles[f] = struct{}{}
	}
	if u.Dir != "" {
		unitFiles[u.Dir] = struct{}{}
	}

	var missingFiles []string
	for f := range graphFiles {
		if _, present := unitFiles[f]; !present {
			missingFiles = append(missingFiles, f)
		}
	}
	if len(missingFiles) > 0 {
		sort.Strings(missingFiles)
		log.Printf("Warning: The graph output (defs/refs/docs/anns) for source unit %+v contain %d references to files that are not present in the source unit's Files list. Indexed lookups by any of these missing files will return no results. To fix this, ensure that the source unit's Files list includes all files that appear in the graph output. The missing files are: %s.", u.ID2(), len(missingFiles), strings.Join(missingFiles, " "))
	}
}
开发者ID:ildarisaev,项目名称:srclib,代码行数:41,代码来源:indexed.go

示例2: SelectUnit

func (f unitDefOffsetsFilter) SelectUnit(u *unit.SourceUnit) bool {
	_, present := f[u.ID2()]
	return present
}
开发者ID:jpoler,项目名称:srclib,代码行数:4,代码来源:index.go

示例3: SelectUnit

func (f byUnitsFilter) SelectUnit(unit *unit.SourceUnit) bool {
	return (unit.Type == "" && unit.Name == "") || f.contains(unit.ID2())
}
开发者ID:xuy,项目名称:srclib,代码行数:3,代码来源:filter.go


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