I'm trying to use this Go lang forum software https://github.com/kjk/fofou. It requires a config file in the top level forums directory to specify certain information about the forum (name, url etc). For example, the file that the software designer uses is forums/sumatrapdf_config.json
in main.go there is this function that reads forum config files
func readForumConfigs(configDir string) error {
pat := filepath.Join(configDir, "*_config.json")
fmt.Println("path", pat)
files, err := filepath.Glob(pat)
fmt.Println("files", files, err)
if err != nil {
return err
}
if files == nil {
return errors.New("No forums configured!")
}
for _, configFile := range files {
var forum ForumConfig
b, err := ioutil.ReadFile(configFile)
if err != nil {
return err
}
err = json.Unmarshal(b, &forum)
if err != nil {
return err
}
if !forum.Disabled {
forums = append(forums, &forum)
}
}
if len(forums) == 0 {
return errors.New("All forums are disabled!")
}
return nil
}
I've played around with the second argument to the Join, calling it by the file name specifically and with the wildcard *, but I keep getting error messages telling me there are no files.
the log statements show the path that it's checking as well as the fact that no files are found
path forums/*funnyforum_config.json files [] 2014/07/25 10:34:11 Failed to read forum configs, err: No forums configured!
The same thing happens if I try to describe the config with a wildcard *
as is done in the source code by the software creator
func readForumConfigs(configDir string) error { pat := filepath.Join(configDir, "*_config.json") fmt.Println("path", pat) files, err := filepath.Glob(pat) fmt.Println("files", files)
path forums/*_config.json files [] 2014/07/25 10:40:38 Failed to read forum configs, err: No forums configured!
In the forums directory, I have put various config files
funnyforum_config.json _config.json
as well as the config it came with
sumatrapdf_config.json