[go-nuts] Create a file and control whether to overwrite or not

2017-09-17 Thread Tamás Gulácsi
Why the double open? mode:=os.O_RDWR... if overwrite { mode |= os.O_TRUNC} os.OpenFile(name, mode) -- 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 golang-nuts+uns

[go-nuts] Create a file and control whether to overwrite or not

2017-09-17 Thread DrGo
Hello, The default behaviour of os.Create is to truncate the file if already exists. I wrote the code below to control whether the file should be overwritten or not (possibly based on user wishes). Seems to work on MacOS. Do you think this code will work on Windows and Linux? Do you see any subt