packagemainimport("encoding/json""fmt""/something/models""os""path/filepath""runtime")funcWriteDeviceToFile(dchan*models.Device,fileNamestring){_,b,_,_:=runtime.Caller(0)basepath:=filepath.Dir(b)filePath:=basepath+"/dataFile/"+fileNamevarf*os.Filevarerrerrorf,_=os.OpenFile(filePath,os.O_APPEND|o