Initial commit
This commit is contained in:
commit
33b14154cf
16
cmd/O1/main.go
Normal file
16
cmd/O1/main.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("Opening file...")
|
||||||
|
file, err := os.OpenFile("./input.txt", os.O_RDONLY, 0644)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
}
|
||||||
19
internal/utils.go
Normal file
19
internal/utils.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Must[T any](obj T, err error) T {
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
func Init() []byte {
|
||||||
|
fmt.Println("Opening file...")
|
||||||
|
return Must(os.ReadFile("./input.txt"))
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user