7785372e3a
This work refactors saving and extracting function from the utils package to the models package as it is a main component of the tool. `utils` will take care of not related to models functions (such as finding the files for example). Also creating unique files for each type of source we are parsing.
21 lines
351 B
Go
21 lines
351 B
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func SaveDomains(domains []string) {
|
|
f, err := os.OpenFile("domains.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
if err != nil {
|
|
logrus.Error(err)
|
|
}
|
|
defer f.Close()
|
|
|
|
for _, d := range domains {
|
|
if _, err := f.WriteString(d + ","); err != nil {
|
|
logrus.Error(err)
|
|
}
|
|
}
|
|
}
|