1. 首页
  2. 考试认证
  3. 其它
  4. findup 使用Go在当前工作目录或最近的祖先目录中找到匹配的第一个文件,直到root

findup 使用Go在当前工作目录或最近的祖先目录中找到匹配的第一个文件,直到root

上传者: 2024-10-16 16:20:23上传 ZIP文件 2.43KB 热度 15次

findup是一个小包,用于在当前目录或最近的祖先目录中查找匹配的第一个文件,直到根目录,并具有额外的支持。该工具适用于Go版本>= 1.1

使用方法

  • 安装命令:go get github.com/h2non/findup

  • 导入包:import \"github.com/h2non/findup\"

查找文件


path, err := findup.Find(\"findup.go\")

fmt.Println(path) // -> /full/path/to/findup.go

使用Glob模式查找文件


path, err := findup.Find(\"findup.*\")

fmt.Println(path) // -> /full/path/to/findup.go

下载地址
用户评论