scan

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scan 提供来源检查和分批读取目录的流式检索。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(dir, path string) bool

Contains 判断目录是否包含路径,比较以当前平台的路径规则为准。

func Covered

func Covered(by, source Source) bool

Covered 判断来源是否已由另一来源覆盖。

func OutputPath

func OutputPath(path string) (string, error)

OutputPath 规范化可能尚未创建的输出目录,解析已有父目录中的符号链接。

func Resolve

func Resolve(ctx context.Context, paths []string) ([]Source, []Issue, error)

Resolve 只检查直接选择的路径,不枚举目录内容。

func Walk

func Walk(ctx context.Context, root, output string, visit func(File) error, issue func(Issue)) error

Walk 分批读取目录,发现文件后同步调用 visit,等待其处理完再继续检索。 不收集全部文件或全局去重表;空间占用取决于目录深度,每层最多缓存 128 个条目。 内部符号链接及输出子目录会跳过。visit 返回错误时立即停止。

Types

type File

type File struct {
	Path        string
	RelativeDir string
}

File 包含绝对路径及相对于所选根目录的父目录。

type Issue

type Issue struct {
	Path string
	Err  error
}

Issue 描述无法访问的路径;其他可访问路径仍会继续处理。

type Source

type Source struct {
	Path      string
	Directory bool
}

Source 是用户直接添加的文件或目录。目录在转换开始后才展开。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL