Пример #1
0
func doGlob(gp GlobPattern) []Value {
	names := glob.Pattern(gp).Glob()
	vs := make([]Value, len(names))
	for i, name := range names {
		vs[i] = String(name)
	}
	return vs
}
Пример #2
0
func doGlob(gp GlobPattern, abort <-chan struct{}) []Value {
	names := []string{}
	if !glob.Pattern(gp).Glob(func(name string) bool {
		select {
		case <-abort:
			Logger.Println("glob aborted")
			return false
		default:
		}
		names = append(names, name)
		return true
	}) {
		throw(ErrInterrupted)
	}
	vs := make([]Value, len(names))
	for i, name := range names {
		vs[i] = String(name)
	}
	return vs
}