Skip to content

Conversation

@marktech0813
Copy link

f := createFile("/tmp/defer.txt") : This code does not work in Windows.
Corrected universal code:
f := createFile(filepath.Join(os.TempDir(), "defer.txt"))

…a#562

 f := createFile("/tmp/defer.txt")  : This code does not work in Windows.
Corrected universal code:
f := createFile(filepath.Join(os.TempDir(), "defer.txt"))
Copy link
Collaborator

@eliben eliben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try running this example? It won't compile, since filepath was not imported.

Also, make sure the example is translated to output HTML properly by going through the steps at https://github.com/mmcgrana/gobyexample?tab=readme-ov-file#building and checking locally

@marktech0813
Copy link
Author

ok. I will check and fix it soon.

@marktech0813
Copy link
Author

If you’re hitting a compile error in a branch or a different example, add the missing import:
import "path/filepath"

@eliben eliben mentioned this pull request Nov 10, 2025
@eliben
Copy link
Collaborator

eliben commented Nov 10, 2025

Fixed in #632

@eliben eliben closed this Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants