type ReadDirOp … type ReadDirOption … // WithExt filters file names by their extensions. // (e.g. WithExt(".wal") to list only WAL files) func WithExt(ext string) ReadDirOption { … } func (op *ReadDirOp) applyOpts(opts []ReadDirOption) { … } // ReadDir returns the filenames in the given directory in sorted order. func ReadDir(d string, opts ...ReadDirOption) ([]string, error) { … }