h2non / findup

Find the first file matching in a current working directory or the nearest ancestor directory up to root using Go

Repository from Github https://github.comh2non/findupRepository from Github https://github.comh2non/findup

findup.go Build Status GitHub release GoDoc

A Go tiny package to find the first file matching in the current directory or the nearest ancestor directory up to root, with additional Glob patterns support. Inspired in node's findup

It works in Go >= 1.1. See Travis builds

Installation

go get github.com/h2non/findup

Usage

Import the package

import "github.com/h2non/findup"

Find a file

path, err := findup.Find("findup.go")
fmt.Println(path) // -> /full/path/to/findup.go

Find a file using a Glob pattern

path, err := findup.Find("findup.*")
fmt.Println(path) // -> /full/path/to/findup.go

Detailed API documentation is available via GoDoc

Development

go test

License

MIT - Tomas Aparicio

About

Find the first file matching in a current working directory or the nearest ancestor directory up to root using Go

License:MIT License


Languages

Language:Go 100.0%