Skip to content

Conversation

@ZauberNerd
Copy link
Contributor

@ZauberNerd ZauberNerd commented Mar 4, 2022

This commit introduces os.DevNull exports for all supported OS
targets.
I had to introduce a new file file_wasi.go in order to export a
different value for file_windows.go (NUL) and keep /dev/null for
all other targets.

I'll create this PR as draft, because I have a few open questions:
I'm not sure, if this works correctly with the build tags or if the file_anyos.go takes precedence over the file_windows.go.
Other options that I see:

  1. export from file_other.go, file_unix.go and file_windows.go, ignoring WASI
    1.1 create a separate file_wasi.go to be able to export DevNull there too (seems overkill?)
  2. export only from file_anyos.go and file_other.go, ignoring Windows

@ZauberNerd ZauberNerd force-pushed the devnull branch 3 times, most recently from bbea6ff to 8ca273a Compare March 5, 2022 00:28
@ZauberNerd ZauberNerd marked this pull request as ready for review March 5, 2022 00:28
This commit introduces `os.DevNull` exports for all supported OS
targets.
@QuLogic
Copy link
Contributor

QuLogic commented Mar 6, 2022

If this will be supported everywhere, that will be helpful for #2515.

Copy link
Contributor

@dkegel-fastly dkegel-fastly left a comment

Choose a reason for hiding this comment

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

LGTM

@deadprogram
Copy link
Member

Thank you @ZauberNerd 🔥 merging.

@deadprogram deadprogram merged commit 3f69c32 into tinygo-org:dev Mar 8, 2022
@ZauberNerd ZauberNerd deleted the devnull branch March 9, 2022 14:37
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.

4 participants