fast-replace/go-fast-replace/cmd/corpus/main.go

32 lines
486 B
Go
Raw Permalink Normal View History

2023-12-30 21:35:09 +00:00
package main
import (
"fmt"
"log"
2023-12-31 17:18:29 +00:00
"strconv"
2023-12-30 21:35:09 +00:00
"os"
"internal/corpus"
)
func main() {
fmt.Println("Creating corpus...")
f, err := os.OpenFile("./csv/corpus.csv", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
if err != nil {
log.Fatal(err)
}
defer f.Close()
2023-12-31 17:18:29 +00:00
var total int = 1000
if len(os.Args) > 1 {
i, err := strconv.Atoi(os.Args[1])
if err != nil {
log.Fatal(err)
}
total = i
}
corpus := corpus.MakeCorpus(total)
2023-12-30 21:35:09 +00:00
2023-12-31 17:18:29 +00:00
f.WriteString(corpus)
2023-12-30 21:35:09 +00:00
}