advent-20/solutions/utils.go

24 lines
370 B
Go
Raw Normal View History

2024-02-25 01:39:28 +00:00
package solutions
import (
"fmt"
"os"
)
const DIR = "/home/fernando/GolandProjects/advent-20/"
func ReadInput(day string, isTest bool) string {
testStr := ""
if isTest {
2024-02-25 02:21:42 +00:00
testStr = "_test"
2024-02-25 01:39:28 +00:00
}
2024-02-25 02:21:42 +00:00
bytes, err := os.ReadFile(DIR + "inputs" + testStr + "/" + day + ".txt")
2024-02-25 01:39:28 +00:00
if err != nil {
fmt.Println(err)
panic("Error reading file.")
}
return string(bytes)
}