Unable to os.Create

Hi everyone,

New to Go and going through the gobyexample.com exercises.
Got to the Defer exercise that involves creating a file in order to defer its closure.

For some reason I am unable to create properly and see this error:
The system cannot find the path specified

I’m using Go 1.7.4 on Windows 10 (64 bit) operating system.

Please advise,

Thanks!

Hey @eigen,

The problem is probably that you are trying to create a file in the /tmp directory, which is common in unix based systems, but doesn’t exists on Windows systems.

Try replacing /tmp/defer.txt to something like defer.txt and the file should be created in the same directory where you run your code.

1 Like

That worked !
Thanks for the help and thorough explanation !

1 Like

No worries :slight_smile:

Happy coding :smiley:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.