func dfs(file string) {
	file = filepath.Clean(file)
	absPath, err := filepath.Abs(file)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable to get absolute path of the file %s; err: %s\n", file, err)
	}
	if _, ok := visited[file]; ok {
		return
	}
	visited[file] = true
	s, err := os.Stat(absPath)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable to stat file %s; err: %s\n", file, err)
		return
	}
	if s.IsDir() {
		basepath := filepath.Clean(file)
		filelist, _ := ioutil.ReadDir(absPath)
		for _, f := range filelist {
			dfs(basepath + string(os.PathSeparator) + f.Name())
		}
	} else if strings.ContainsAny(s.Mode().String(), "alTLDpSugct") {
	} else {
		indexMap[absPath] = true
	}
}
/* skip all files that are :
a: append-only
l: exclusive use
T: temporary file; Plan 9 only
L: symbolic link
D: device file
p: named pipe (FIFO)
S: Unix domain socket
u: setuid
g: setgid
c: Unix character device, when ModeDevice is set
t: sticky
package util
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/gorilla/websocket"
	"github.com/hpcloud/tail"
)
var (
	FileList []string
	visited  map[string]bool
	indexMap = make(map[string]bool)
)
func TailFile(conn *websocket.Conn, fileName string) {
	t, err := tail.TailFile(fileName,
		tail.Config{
			Follow: true,
			Location: &tail.SeekInfo{
				Whence: os.SEEK_END,
			},
		})
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error occurred in opening the file: ", err)
	}
	for line := range t.Lines {
		conn.WriteMessage(websocket.TextMessage, []byte(line.Text))
	}
}
func IndexFiles(fileList []string) error {
	visited = make(map[string]bool)
	for k := range indexMap {
		indexMap[k] = false
	}
	for _, file := range fileList {
		dfs(file)
	}
	FileList = make([]string, 0)
	for k, v := range indexMap {
		if v == false {
			delete(indexMap, k)
			continue
		}
		fmt.Fprintln(os.Stderr, k)
		FileList = append(FileList, k)
	}
	Conf.Dir = FileList
	fmt.Fprintln(os.Stderr, "Indexing complete !, file index length: ", len(Conf.Dir))
	return nil
}