No, there isn't. There have been long discussions
about this. Searching the archives for 'atexit' should
turn them up.
Russ
That doesn't work if you're using a library that calls os.Exit
(unless you're willing to take on the load of fetching it's
source and running edits over it each time it changes).
Chris
--
Chris "allusive" Dollin
That doesn't work if you're using a library that calls os.Exit
Yeah, that too. But it depends on the other party /doing/ something,
which is not guaranteed.
>That doesn't work if you're using a library that calls os.Exit
> A solution would be that Go would have a tool for looking for os.Exit
> and log.Fatal in Go source files. This would avoid a lot of headaches
It's called grep.
You give by fact 2 things:
* every developer know grep (and know to use it), included Windows
develpers
* they know that a possible error could be caused by the use of
os.Exit
One tool, included in Go toolchain, would be very useful to looking
for possible warning in source files.
Or simply, that at compiling a package, were shown a warning when it's
used os.Exit and log.Fatal
> Grep has a 38 year old history. Nothing to do with being a Windows
> developer (aka it's not an excuse for anything).
The history has not something to see with the fact of that Windows
comes without grep (by default).
> > * they know that a possible error could be caused by the use of
> > os.Exit
>
> No such assertion was presented.
Then, for that case, like a developer doesn't know if there is an
error due to os.Exit,
the best would be a tool that looks for those
warnings.
> > One tool, included in Go toolchain, would be very useful to looking
> > for possible warning in source files.
>
> Anyone can just write and publish it. Though I doubt it would have any
> value - as a one special case tool instead of the general ones like grep
> (and friends).
Yes, of course, But it would be very helpful if were included in the
Go toolchain to detect those possible errors.
> What about libraries that print to os.Stdout, or to os.Stderr? There areThose libraries that print there doesn't interrumpt a program like it
> countless things like this.
is done by os.Exit.