[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-30 Thread Manlio Perillo
On Friday, August 24, 2018 at 11:20:46 AM UTC+2, Paweł Szczur wrote: > > Hi, > > I have a long running hobby program with a code: > > var ( >url = "https://example.com"; >lastBody []byte > ) > > > func get(client *http.Client, dir) (changed bool, data []byte, err error) { > >resp,

Re: [go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-29 Thread Matt Harden
>From the program's perspective the file is indeed flushed on close. The kernel deferring writes to disk can only have any effect if the system crashes, and the files will be flushed to disk within a short time anyway. You absolutely do NOT need to call fsync every file on close unless you require

[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-27 Thread Manlio Perillo
No, the file is not flushed on close. https://linux.die.net/man/2/close "A successful close does not guarantee that the data has been successfully saved to disk, as the kernel defers writes. It is not common for a file system to flush the buffers when the stream is closed. If you need to be sur

[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-27 Thread Paweł Szczur
If you're asking about dmesg, I'm not seeing anything related. Yes, I'm on linux. The dir was created successfully, I guess it was not a problem. Also, I believe the file is flushed on Close. I will look into the link. Paweł On Friday, August 24, 2018 at 6:33:15 PM UTC+2, Manlio Perillo wrote:

[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-27 Thread Paweł Szczur
No. On Friday, August 24, 2018 at 6:47:01 PM UTC+2, dja...@gmail.com wrote: > > Hi, > did you write files in /tmp on linux ? > (and there is daemon that clean old files in /tmp ?) > > Regards, > Djadala > > > -- You received this message because you are subscribed to the Google Groups "golang-n

[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-24 Thread djadala
Hi, did you write files in /tmp on linux ? (and there is daemon that clean old files in /tmp ?) Regards, Djadala -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-24 Thread Manlio Perillo
On Friday, August 24, 2018 at 4:19:17 PM UTC+2, Paweł Szczur wrote: > > Thanks. Both things you mentioned are already fixed. The MakeDir may of > course fail and now I handle it, but in described situation it was not an > issue. > The files were written for most of the day successfully and sudden

[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-24 Thread Paweł Szczur
Thanks. Both things you mentioned are already fixed. The MakeDir may of course fail and now I handle it, but in described situation it was not an issue. The files were written for most of the day successfully and suddenly they stopped to appear. The disk was and is not full. There was no error r

[go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-24 Thread Manlio Perillo
On Friday, August 24, 2018 at 11:20:46 AM UTC+2, Paweł Szczur wrote: > > Hi, > > I have a long running hobby program with a code: > > var ( >url = "https://example.com"; >lastBody []byte > ) > > > func get(client *http.Client, dir) (changed bool, data []byte, err error) { > >resp,