Re: [go-nuts] Wrapping executable that takes input and output files such that it uses stdin and stdout instead (using named pipes)

2018-02-09 Thread Matt Harden
You need to close fIn after the copy is done. As it is now, fIn.Close() happens after io.Copy(os.Stdout, buf), which completes after your cat command finishes. But cat won't finish until its input pipe returns EOF, which happens after fIn.Close(). On Wed, Feb 7, 2018 at 5:46 PM Or Rikon

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-09 Thread as
Probably because UUIDv4 is the most common type and is trivial to approximate. For other requirements, there are non-RFC conformant implementations that achieve the desired properties https://github.com/segmentio/ksuid On Wednesday, February 7, 2018 at 5:43:08 PM UTC-8, 高橋誠二 wrote: > >

Re: [go-nuts] Controlling calldepth in log.Logger

2018-02-09 Thread Bret Jordan
I know this thread is old... But for people that are looking for some simple logging by level functionality I have added basic logging levels to the default Go log package. You can find my changes here: https://github.com/gologme/log In addition to adding Info, Warn, and Debug, users can also

[go-nuts] Re: is there an atexit?

2018-02-09 Thread Richard Wilkes
You could try something like this: https://github.com/richardwilkes/toolbox/blob/master/atexit/atexit.go I think the discussion here has missed the primary reason I have such code in many of my programs: to cleanly shutdown when asked to terminate, either by CTRL-C or someone issuing a

[go-nuts] Re: is there an atexit?

2018-02-09 Thread Dave Cheney
Your program has a data race in the exitcode variable. -- 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+unsubscr...@googlegroups.com. For more

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
On Saturday, February 10, 2018 at 2:18:23 AM UTC+7, andrey mirtchovski wrote: > > If you mix dynamic libraries with static ones in the same folder the > -L -l trick won't work. a workaround is to softlink the .a files to a > separate folder so that the linker doesn't see the .so/.dylib files.

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread andrey mirtchovski
If you mix dynamic libraries with static ones in the same folder the -L -l trick won't work. a workaround is to softlink the .a files to a separate folder so that the linker doesn't see the .so/.dylib files. On Fri, Feb 9, 2018 at 12:11 PM, Jason E. Aten wrote: >> Note that

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
> > Note that the _ALLOW environment variables hold a regular expression, > so you could also write CGO_LDFLAGS_ALLOW='.*\.a'. > Thank you, Ian. That's much more palatable. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Ian Lance Taylor
On Fri, Feb 9, 2018 at 10:05 AM, Jason E. Aten wrote: > Yay. I found a workaround--or rather, finally understood one of the > suggestions. > > Adding the following CGO_LDFLAGS_ALLOW hack in the Makefiles allows linking > against the named .a file. > > export >

[go-nuts] Re: is there an atexit?

2018-02-09 Thread frederic . meyer . 77
Here there is a solution which is cheap to use: https://gist.github.com/ZaniaDeveloper/8a5e4b804a5d7335080d7a7647f08f92 > > -- 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

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
Yay. I found a workaround--or rather, finally understood one of the suggestions. Adding the following CGO_LDFLAGS_ALLOW hack in the Makefiles allows linking against the named .a file. export

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
I added comments on #23749, but sadly the -L -l suggested workaround just makes a bad situation worse. It converts a linktime error into a runtime error. Details in the 23749 comment. It appears that this CL, that adds the forgotten support for linking against .a files, is what is needed:

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread andrey mirtchovski
Please add your comments to this issue: https://github.com/golang/go/issues/23749 There are already a couple of reports for that particular usage pattern, one of which is mine. For now you have the option to do: #cgo LDFLAGS: -L${SRCDIR}/../../../LuaJIT/LuaJIT/src -lluajit -lm -ldl There are

[go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
on OSX, with the newly minted go1.9.4 with its cgo flag restrictions, I am telling the linker what libraries to link against: (here https://github.com/gijit/gi/blob/master/vendor/github.com/glycerine/golua/lua/lua.go#L10 ) ~~~ #cgo LDFLAGS: ${SRCDIR}/../../../LuaJIT/LuaJIT/src/libluajit.a

Re: [go-nuts] Re: ANN: gijit, a Go interpreter

2018-02-09 Thread Jason E. Aten
You're welcome. I would add credit to Lua's originators and contributors from around the world. Roberto Ierusalimschy et al's design and evolution of Lua over the last 25 years make it a (perhaps surprisingly) great tool for this purpose. It certainly surprised me. Lua's primary goal of acting

Re: [go-nuts] Re: Why is there no standard `uuid` package?

2018-02-09 Thread Sotirios Mantziaris
i agree that since there exist a RFC it should not be that much of a problem. On Friday, February 9, 2018 at 9:52:33 AM UTC+2, Henry wrote: > > @axel: The specification for UUID is defined in RFC 4122. You are free to > use it or create your own variants. However, the specs is there. -- You