This commit is contained in:
Gregory Salaun 2023-12-17 15:19:23 +07:00
parent 782bf1db05
commit b2b125114c

View File

@ -3,11 +3,18 @@ package main
import (
"log"
"os"
"path/filepath"
)
func main() {
f, err := os.OpenFile("./log.txt", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
ex, err := os.Executable()
if err != nil {
panic(err)
}
exPath := filepath.Dir(ex)
f, err := os.OpenFile(exPath+"/log.txt", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}