在CronJob中运行时,代码无法创建文件

I'm trying to create a CronJob that is creating a file and writing some string to it. The Code does work when run as normal go code. Also the code itself is executed when run as a Cronjob (I checked /var/log/syslog and let Print something with „fmt.Print("some string")) The Problem is that the file I want to create is not created when the Cronjob is executed (I'm root on my Server so „crontab -e” should have enough permissions shouldn't it?)

Code:

package main

import (
    "os"
    "path/filepath"
    "fmt"   
    "github.com/Sirupsen/logrus"

)

func main() {

absPath, err := filepath.Abs("loggy.txt")
if err != nil {
    fmt.Print("Error
")
}


file, err := os.OpenFile(absPath, os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666)
if err != nil {
    fmt.Print("Error
")
}


var loggy logrus.Logger
loggy.Out = file
loggy.Level = logrus.DebugLevel
formatter := &logrus.TextFormatter{}
formatter.ForceColors = true
formatter.FullTimestamp = true
loggy.Formatter = formatter

loggy.Warn("Test")

}

crontab -e:

*/01   *  *  *  * /root/PathToFile/CronJob/./CronJob

Any help is appreciated

So go adjusts the current directory to the directory of crontab when being executed in a Cronjob or the other way round regardingly