You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
path.Join - not joining in a manner where path.Match can return correct results.
2020/09/26 21:31:59 Find match for: C:\data\projects_go\go-mail\input/*556*.csv
2020/09/26 21:31:59 FIle : C:\data\projects_go\go-mail\input/*556*.csv C:\data\projects_go\go-mail\input
2020/09/26 21:31:59 FIle : C:\data\projects_go\go-mail\input/*556*.csv C:\data\projects_go\go-mail\input\input556.csv
2020/09/26 21:31:59 [] <- hmm no files found! input566.csv must be found.
'''golang
func filesMatch(conf FileProcessorConfig) (files []MyNonsenseWorkaroundFileInfo, err error) {
matchGlob := conf.InputDir + conf.GlobPath //path.Join - Does not work for windows(see log snippet below), going back to +
log.Println("Find match for:", matchGlob)
// 2020/09/26 21:31:59 Find match for: C:\data\projects_go\go-mail\input/556.csv
// 2020/09/26 21:31:59 FIle : C:\data\projects_go\go-mail\input/556.csv C:\data\projects_go\go-mail\input
// 2020/09/26 21:31:59 FIle : C:\data\projects_go\go-mail\input/556.csv C:\data\projects_go\go-mail\input\input556.csv
// 2020/09/26 21:31:59 [] <- hmm no files found! input566.csv must be found.
// var files []os.FileInfo
err = filepath.Walk(conf.InputDir,
func(walkPath string, info os.FileInfo, err error) error {
if err != nil {
return err
}
// log.Println("File :", matchGlob, walkPath)
if matched, _ := path.Match(matchGlob, walkPath); matched == true { //info.Mode().IsRegular()
if isOlderThanSecs(info.ModTime(), conf.OlderThanSeconds) {
log.Println("Match: ", walkPath)
}
myNonsenseFinfoWithPath := MyNonsenseWorkaroundFileInfo{path: walkPath, info: info}
files = append(files, myNonsenseFinfoWithPath) //fileInfo is expensive, just return and reuse
} else {
//fmt.Println("Skip: ", walkPath, info.Size())
}
return nil
}) //filewalk
return
}'''
Expectation :
Path match should work in windows if the paths are provided in these formats
Config1.yml
fileProcessor:
globPath: "*556*.csv"olderThanSeconds: 2inputDir : "C:\\data\\projects_go\\go-mail\\input\\"<- ugly, not redable, other languages java/python support usage of c:/data/projects_go/...
Config1.yml - path.Join must include missing slash "/" or "\", and path.Match must be able to find the pattern in windows.
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
path.Join - not joining in a manner where path.Match can return correct results.
'''golang
func filesMatch(conf FileProcessorConfig) (files []MyNonsenseWorkaroundFileInfo, err error) {
matchGlob := conf.InputDir + conf.GlobPath //path.Join - Does not work for windows(see log snippet below), going back to +
log.Println("Find match for:", matchGlob)
// 2020/09/26 21:31:59 Find match for: C:\data\projects_go\go-mail\input/556.csv
// 2020/09/26 21:31:59 FIle : C:\data\projects_go\go-mail\input/556.csv C:\data\projects_go\go-mail\input
// 2020/09/26 21:31:59 FIle : C:\data\projects_go\go-mail\input/556.csv C:\data\projects_go\go-mail\input\input556.csv
// 2020/09/26 21:31:59 [] <- hmm no files found! input566.csv must be found.
}'''
Expectation :
Path match should work in windows if the paths are provided in these formats
Config1.yml
Config1.yml - path.Join must include missing slash "/" or "\", and path.Match must be able to find the pattern in windows.
The text was updated successfully, but these errors were encountered: