package converter import ( "fmt" "os" "sync" goutil "git.fireandbrimst.one/aw/goutil/misc" "github.com/russross/blackfriday/v2" ) func convert(f string) { outfile := f[0:len(f)-len(".md")] + ".html" input, err := goutil.ReadFile(f) if err != nil { fmt.Fprintln(os.Stderr, err) } output := string(blackfriday.Run([]byte(input))) goutil.WriteFile(outfile, output) err = os.Remove(f) if err != nil { fmt.Fprintln(os.Stderr, err) } } func ConvertAll(files []string) { var wg sync.WaitGroup wg.Add(len(files)) for _, f := range files { go func(file string) { defer wg.Done() convert(file) }(f) } wg.Wait() }