本文整理汇总了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, " "))
}
}
示例2: SelectUnit
func (f unitDefOffsetsFilter) SelectUnit(u *unit.SourceUnit) bool {
_, present := f[u.ID2()]
return present
}
示例3: SelectUnit
func (f byUnitsFilter) SelectUnit(unit *unit.SourceUnit) bool {
return (unit.Type == "" && unit.Name == "") || f.contains(unit.ID2())
}