comparison zs.go @ 30:526ba3c717ba draft

added check for fs walk errors
author zaitsev.serge
date Sun, 30 Aug 2015 21:16:51 +0000
parents dd669a7e582f
children b2f491299cee
comparison
equal deleted inserted replaced
29:dd669a7e582f 30:526ba3c717ba
239 os.Mkdir(PUBDIR, 0755) 239 os.Mkdir(PUBDIR, 0755)
240 funcs := builtins() 240 funcs := builtins()
241 err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error { 241 err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
242 // ignore hidden files and directories 242 // ignore hidden files and directories
243 if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") { 243 if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") {
244 return nil
245 }
246 // inform user about fs walk errors, but continue iteration
247 if err != nil {
248 log.Println("ERROR:", err)
244 return nil 249 return nil
245 } 250 }
246 251
247 if info.IsDir() { 252 if info.IsDir() {
248 os.Mkdir(filepath.Join(PUBDIR, path), 0755) 253 os.Mkdir(filepath.Join(PUBDIR, path), 0755)