Re: [go-nuts] Re: Golang concurrency design question

2016-07-13 Thread Dan Kortschak
On Wed, 2016-07-13 at 23:13 -0700, Richard Todd wrote: > I don't think there is a right answer here, without a context. > Yeah. The net package is instructive here. There are cases where a goroutine is spawned with the acquireThread call (this blocks on a chan operation to limit thread use) just

Re: [go-nuts] Re: Generation of Strings - generation

2016-07-13 Thread Michael Jones
The first time this came up I wrote code to generate general alphabet combinations as quickly as I could. The approach I used was a generator object that one calls to set the length and alphabet size, and a Next() function that is called repeatedly until it signals that all values have been gene

Re: [go-nuts] Re: Golang concurrency design question

2016-07-13 Thread Richard Todd
To give the other side of the argument: If you have something useful to do between the loop and the wg.Wait(), that would be a reason to consider just launching them all. Also, I guess in theory the runtime's scheduler might do a better job if it knows about the total amount of work that's waiti

Re: [go-nuts] Re: Golang concurrency design question

2016-07-13 Thread Dan Kortschak
Mostly. As always, the exact context is significant. On Thu, 2016-07-14 at 15:34 +0930, Dan Kortschak wrote: > Yes. This is how it's done in the net package. > > On Wed, 2016-07-13 at 23:01 -0700, sphilip...@gmail.com wrote: > > Block then spawn: https://play.golang.org/p/fUZ2RKr-u0 -- You rec

Re: [go-nuts] Re: Golang concurrency design question

2016-07-13 Thread Dan Kortschak
Yes. This is how it's done in the net package. On Wed, 2016-07-13 at 23:01 -0700, sphilip...@gmail.com wrote: > Block then spawn: https://play.golang.org/p/fUZ2RKr-u0 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

[go-nuts] Re: Golang concurrency design question

2016-07-13 Thread sphilippov
Block then spawn: https://play.golang.org/p/fUZ2RKr-u0 -- 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 options,

Re: [go-nuts] filepath.Clean

2016-07-13 Thread brainman
I don't remember. I suspect I was only worried about making tests pass. And keep existing code as simple as I have found it. (Just as Ian explained) Alex On Thursday, 14 July 2016 06:41:53 UTC+10, Anmol Sethi wrote: > > I’ve cced him, hopefully he can state exactly why. > > > On Jul 13, 2016, a

[go-nuts] Re: cockroachdb install with the homebrew option on Mac OS X El Capitan

2016-07-13 Thread Young Lee
My bad, Well, turns out that our company is using a thirdparty filtering service and apparently is blocking access to the url https://honnef.co/go/unused?go-get=1 , :( - Young On Saturday, April 2, 2016 at 6:55:14 PM UTC-7, Young Lee wrote: > > Hi, > > I saw the cockroachdb beta announcement an

[go-nuts] Golang concurrency design question

2016-07-13 Thread nakuldesai88
I was going through the concurrent directory traversal program (similar to the unix du command) provided as an example in the "Go Programming Language" book (by Kernighan and Donovan). The example is on lines of the following (slightly modified to clarify the question): *// semaphore to contro

[go-nuts] Re: Reverse proxy with HTTP2 support

2016-07-13 Thread Tamás Gulácsi
caddyserver.com -- 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 options, visit https://groups.google.com/d/opto

[go-nuts] Re: How to make the first character in a string lowercase?

2016-07-13 Thread Tamás Gulácsi
But this works only for ASCII input! -- 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 options, visit https://gro

Re: [go-nuts] Streaming deflate - can't reliably read chunks as they arrive instead of the entire stream

2016-07-13 Thread Nigel Tao
On Thu, Jul 14, 2016 at 12:35 AM, A Keeton wrote: > I'm trying to decompress messages arriving over websockets that are using > permessage-deflate. You say that you're using "per message" deflate... > Each new websockets message is written into buf and then I call Read on ...but then it sounds

Re: [go-nuts] Re: any way to save an image to 8-bit indexed png format?

2016-07-13 Thread Nigel Tao
On Thu, Jul 14, 2016 at 2:07 AM, wrote: > [haven't actually checked if the PNG package will work with this - but this > would be the way to go if supported] The PNG package should work with this: https://play.golang.org/p/Sxl-nLnecy -- You received this message because you are subscribed to th

Re: [go-nuts] What dependency management tool do you use?

2016-07-13 Thread Sean Russell
Hi Nathan, On Wednesday, July 13, 2016 at 11:43:09 AM UTC-4, Nathan Fisher wrote: > Out of curiosity if the upstream deletes their repo does a force push > invalidating a sha or in some other way causes a dangling reference how do you > protect against that without checking the dependency in? I'm

[go-nuts] Trying to verify io.Copy and underlying way of handling files.

2016-07-13 Thread Eliezer Croitoru
I have looked at : https://github.com/rainycape/vfs and I am trying to understand and predict what to be expected from the VFS when I will be using io.Copy on a file. The VFS has a lock on a file but from what I have seen until now in the source code it locks the file on a "read' operation but it

[go-nuts] Re: exec.Cmd: if the child forks Wait may hang forever

2016-07-13 Thread noxiouz
https://github.com/golang/go/blob/master/src/os/exec/exec.go#L484 set io.Writer explicitly so it looks like a bug среда, 13 июля 2016 г., 23:50:56 UTC+3 пользователь noxiouz написал: > > Good day! > > I faced a corner case of cmd.Exec usage and want to find out if it's > designed behavior. > > >

Re: [go-nuts] Plurality of package naming

2016-07-13 Thread 'Thomas Bushnell, BSG' via golang-nuts
They are similar, except for where they are different. Here, we're talking about interfaces, which are very different from struct and class naming conventions. An object has only one class in OOP, but in Go it is normal for a single type to implement many interfaces, including ones it doesn't even

Re: [go-nuts] exec.Cmd: if the child forks Wait may hang forever

2016-07-13 Thread noxiouz
The question it not about how to fork properly =) I really simplified the script. Actually I have to exec code, that I do not control. For me the both usages look the same. Of course, to be on the safe side I am going to use StdoutPipe way, but it looks like a bug for me. At least, I have no w

Re: [go-nuts] exec.Cmd: if the child forks Wait may hang forever

2016-07-13 Thread Steven Hartland
If your forked process still has stdin / stdout open then I would say this is expected. You could confirm this by adding the following to the python script. import sys ... if pid == 0: sys.stdin.close() sys.stdout.close() On 13/07/2016 21:50, noxiouz wrote: Good day! I faced a corner ca

Re: [go-nuts] exec.Cmd: if the child forks Wait may hang forever

2016-07-13 Thread Ian Lance Taylor
On Wed, Jul 13, 2016 at 1:50 PM, noxiouz wrote: > > I faced a corner case of cmd.Exec usage and want to find out if it's > designed behavior. ... > So I would like to find out if setting cmd.Stdout explicitly is not > expected. Sounds like https://golang.org/issue/13155 . Ian -- You received

[go-nuts] exec.Cmd: if the child forks Wait may hang forever

2016-07-13 Thread noxiouz
Good day! I faced a corner case of cmd.Exec usage and want to find out if it's designed behavior. go version go1.6.2 darwin/amd64 and linux > Let's assume we use cmd.Exec to start some process, that can fork and dies, but the fork will live forever. For example: #!/usr/bin/env python import

Re: [go-nuts] filepath.Clean

2016-07-13 Thread Anmol Sethi
I’ve cced him, hopefully he can state exactly why. > On Jul 13, 2016, at 4:02 PM, Ian Lance Taylor wrote: > > On Wed, Jul 13, 2016 at 10:40 AM, Anmol Sethi wrote: >> Why does filepath.Clean replace each slash with a separator at the end of >> the function? What’s the point of attempting to cle

Re: [go-nuts] Initializing a channel as "Closed" so that it doesn't block if a "Thing" hasn't been done yet

2016-07-13 Thread Harmen B
I don't understand the problems 100%, but maybe these things can point you in the right direction: - try to see if using a sync.WaitGroup{} can help you. WaitGroups are great to use when you need to keep track of a varying bunch of Go routines. - you can send channels over channels, to wait for th

Re: [go-nuts] filepath.Clean

2016-07-13 Thread Ian Lance Taylor
On Wed, Jul 13, 2016 at 10:40 AM, Anmol Sethi wrote: > Why does filepath.Clean replace each slash with a separator at the end of the > function? What’s the point of attempting to clean it if the separator used is > incorrect? Wouldn’t doing this at the start of the function make more sense? It

Re: [go-nuts] filepath.Join

2016-07-13 Thread Anmol Sethi
ah they are, I understand now, thanks! > On Jul 13, 2016, at 3:59 PM, Steven Hartland wrote: > > Are the unexported methods OS specific? > > On 13/07/2016 20:56, Anmol Sethi wrote: >> Why does filepath.Join only call to the unexported join? Why not just export >> the unexported join? >> >> >

Re: [go-nuts] filepath.Join

2016-07-13 Thread Steven Hartland
Are the unexported methods OS specific? On 13/07/2016 20:56, Anmol Sethi wrote: Why does filepath.Join only call to the unexported join? Why not just export the unexported join? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] filepath.Join

2016-07-13 Thread Anmol Sethi
Why does filepath.Join only call to the unexported join? Why not just export the unexported join? -- 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+uns

Re: [go-nuts] Rel in path package

2016-07-13 Thread Anmol Sethi
Thanks Ian! > On Jul 13, 2016, at 10:23 AM, Ian Lance Taylor wrote: > > On Wed, Jul 13, 2016 at 2:43 AM, Anmol Sethi wrote: >> Right here: >> https://github.com/nsf/gocode/blob/f535dc686130fcc7b942c504ce5903222a205ca3/autocompletecontext.go#L254 >> >> I have to annoyingly use filepath.ToSlash

Re: [go-nuts] Rel in path package

2016-07-13 Thread Anmol Sethi
fixed here: https://github.com/nsf/gocode/pull/361/files Not sure what I was thinking when I wrote that code. My bad. > On Jul 13, 2016, at 10:23 AM, Ian Lance Taylor wrote: > > On Wed, Jul 13, 2016 at 2:43 AM, Anmol Sethi wrote: >> Right here: >> https://github.com/nsf/gocode/blob/f535dc68613

[go-nuts] filepath.Clean

2016-07-13 Thread Anmol Sethi
Why does filepath.Clean replace each slash with a separator at the end of the function? What’s the point of attempting to clean it if the separator used is incorrect? Wouldn’t doing this at the start of the function make more sense? -- You received this message because you are subscribed to the

Re: [go-nuts] bodyless functions in standard libary

2016-07-13 Thread Aram Hăvărneanu
https://golang.org/doc/asm -- Aram Hăvărneanu -- 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 options, visit

Re: [go-nuts] Re: Reverse proxy with HTTP2 support

2016-07-13 Thread Tim Hawkins
https://github.com/containous/traefik On 14 Jul 2016 2:13 a.m., "Kevin Klues" wrote: > Im curious about this as well. Are there any plans to build native support > for a reverse proxy that can directly forward HTTP/2 traffic to a backend > server? If not, does anyone know of a usable external pro

[go-nuts] Re: Reverse proxy with HTTP2 support

2016-07-13 Thread Kevin Klues
Im curious about this as well. Are there any plans to build native support for a reverse proxy that can directly forward HTTP/2 traffic to a backend server? If not, does anyone know of a usable external project that provides this functionality? On Wednesday, March 30, 2016 at 2:48:11 AM UTC-7,

[go-nuts] Re: How to make the first character in a string lowercase?

2016-07-13 Thread narenarya . 007
On Saturday, November 24, 2012 at 4:21:23 PM UTC+5:30, Nikolai wrote: > > Hi! > > What is the easiest way to make a string "LikeThis" --> "likeThis"? > Here is my answer bytestr := []byte(str) for index, character := range bytestr { char := string(character) if char ==

[go-nuts] Re: [ANN] Vermeer - physically based rendering (raytracing) with Go

2016-07-13 Thread Jamie Clarkson
Ah yes, thanks for that - it should be relatively easy to add back in the Go code to support all architectures (it was all originally Go before rewriting in ASM for the SIMD) so I'll add a note to do that soonish. The SSE4 requirement may be able to be relaxed too as the traversal code doesn'

[go-nuts] Re: [ANN] Vermeer - physically based rendering (raytracing) with Go

2016-07-13 Thread Jamie Clarkson
I can't say I've really thought about using the standard library for handling HDR images, although I can definitely see how that could be useful. As you say it looks tricky to fit the expected colour.Colour behaviour, although there is 16bits to play with there? Mostly I'd be looking to either

Re: [go-nuts] bodyless functions in standard libary

2016-07-13 Thread xiiophen
Thanks - so I assume the exported function Frexp is a golang fallback if the relevant architecture assembly file isn't found (?) Is there any official (or unofficial) documentation on linking assembly from packages? -- You received this message because you are subscribed to the Google Grou

[go-nuts] Initializing a channel as "Closed" so that it doesn't block if a "Thing" hasn't been done yet

2016-07-13 Thread Evan Digby
Hi All, I'm looking for some advice on a pattern I've found myself trapped in. I don't think I like it. For all examples, assume I have to meet the following interface (enforced externally): type DoerCloser interface { Do() Close() } The code below is mostly snippets from: https://play.gol

Re: [go-nuts] bodyless functions in standard libary

2016-07-13 Thread Sam Whited
On Wed, Jul 13, 2016 at 11:11 AM, wrote: > Bodyless functions - such as > https://golang.org/src/math/frexp.go?s=469:514#L6 found in the standard > library are currently mystifying me.. These functions are actually implemented in architecture specific assembly and linked in as part of the build

[go-nuts] Re: overflow, underflow, carry, zero etc in integer ops

2016-07-13 Thread xiiophen
On Tuesday, 12 July 2016 17:40:17 UTC+1, Uli Kunitz wrote: > > You need compare the result with one summand to detect overflow. > > See here: https://play.golang.org/p/3Uh0eFSbQW > > Programming languages usually don't provide access to machine level flags, > because they support combining multi

[go-nuts] bodyless functions in standard libary

2016-07-13 Thread xiiophen
(newb question) Bodyless functions - such as https://golang.org/src/math/frexp.go?s=469:514#L6 found in the standard library are currently mystifying me.. There's an unexported function of the same name and signature on the same file but no call to it. Is this explained somewhere (I read the

[go-nuts] Re: any way to save an image to 8-bit indexed png format?

2016-07-13 Thread xiiophen
On Wednesday, 13 July 2016 03:32:55 UTC+1, sleepy wrote: > > I need to shrink images to as small as possible with an acceptable quality. > found https://tinypng.com/ could convert the image to 8-bit indexed png, > which is best fit my requirement. > > however, I need to do this by my go program,

[go-nuts] Re: Redis / Gin Framework Performance Issue

2016-07-13 Thread desaiabhijit
Unix sockets taken performance to 87 k req/sec redisClient = redis.NewClient(&redis.Options{ Dialer: func() (net.Conn, error) { return net.DialTimeout("unix", "/tmp/redis.sock", 1*time.Second) }, Password: "", DB: 0, PoolSize: 10,

Re: [go-nuts] What dependency management tool do you use?

2016-07-13 Thread Nathan Fisher
Out of curiosity if the upstream deletes their repo does a force push invalidating a sha or in some other way causes a dangling reference how do you protect against that without checking the dependency in? I'm thinking about the recent issue in March with npm ( http://m.theregister.co.uk/2016/03/23

[go-nuts] Streaming deflate - can't reliably read chunks as they arrive instead of the entire stream

2016-07-13 Thread A Keeton
I'm trying to decompress messages arriving over websockets that are using permessage-deflate. I've run into a couple of issues using flate. Assume: buf := new(bytes.Buffer) flater := flate.NewReader(buf) Each new websockets message is written into buf and then I call Read on flater. It wo

[go-nuts] Re: Generation of Strings - generation

2016-07-13 Thread catalasexx
what about https://play.golang.org/p/TbZ-fbhUCb ? the code don't create goroutine. thus you don't have to care about troubles with managing goroutine. 2016년 7월 13일 수요일 오전 6시 36분 15초 UTC+9, The MrU 님의 말: > > Hi, > > I have this code https://play.golang.org/p/9o5TReZ7jT3 >

Re: [go-nuts] Rel in path package

2016-07-13 Thread Ian Lance Taylor
On Wed, Jul 13, 2016 at 2:43 AM, Anmol Sethi wrote: > Right here: > https://github.com/nsf/gocode/blob/f535dc686130fcc7b942c504ce5903222a205ca3/autocompletecontext.go#L254 > > I have to annoyingly use filepath.ToSlash after just in case the user was on > windows. I don't know what that code is

[go-nuts] Re: What dependency management tool do you use?

2016-07-13 Thread Andrew Pogrebnoy
> I love the tool github.com/kardianos/govendor . > Works with the standard go tools and does nothing more or less than I need. > I use it for libraries and commands an

Re: [go-nuts] How can I get running func name?

2016-07-13 Thread Jan Mercl
On Wed, Jul 13, 2016 at 3:56 PM Harry wrote: > I want to keep something records as log and where it is to specify. Many loggers are able to include the file_name:line_number info, which is cheaper to obtain at runtime. -- -j -- You received this message because you are subscribed to the Goo

Re: [go-nuts] How can I get running func name?

2016-07-13 Thread Harry
I want to keep something records as log and where it is to specify. 2016年7月13日水曜日 21時28分52秒 UTC+9 Konstantin Khomoutov: > > On Wed, 13 Jul 2016 04:48:18 -0700 (PDT) > Harry > wrote: > > > func SomethingFunc() { > > fmt.Printf("func is %s\n", funcName) > > /* code */ > > } > > > > I want

Re: [go-nuts] Proposal: Add coloured output to go commands

2016-07-13 Thread Damian Gryski
On Tuesday, July 12, 2016 at 11:26:57 PM UTC-6, Ian Lance Taylor wrote: > > On Tue, Jul 12, 2016 at 9:36 PM, Zac Pullar-Strecker > wrote: > > Commands like go run, go build and go test amoung others should have > > coloured output when an error occurs. it would make reading stack traces > a

Re: [go-nuts] How can I get running func name?

2016-07-13 Thread Konstantin Khomoutov
On Wed, 13 Jul 2016 04:48:18 -0700 (PDT) Harry wrote: > func SomethingFunc() { > fmt.Printf("func is %s\n", funcName) > /* code */ > } > > I want to show func name when running each func. > If I could get func name automatically, same code can be used. What problem are you trying to solve w

Re: [go-nuts] How can I get running func name?

2016-07-13 Thread Harry
Thank you, Jan. It can be helpful!! Harry. 2016年7月13日水曜日 21時03分48秒 UTC+9 Jan Mercl: > > > On Wed, Jul 13, 2016 at 1:48 PM Harry > > wrote: > > > If I could get func name automatically, same code can be used. > > https://play.golang.org/p/XjDcnK78xY > > -- > > -j > -- You received this messa

Re: [go-nuts] How can I get running func name?

2016-07-13 Thread Harry
Thank you, Alex!! That'd be nice for me!! Harry. 2016年7月13日水曜日 20時51分08秒 UTC+9 Axel Wagner: > > https://godoc.org/runtime#Caller > https://godoc.org/runtime#FuncForPC > > On Wed, Jul 13, 2016 at 1:48 PM, Harry > > wrote: > >> Hello, everyone. >> >> As title, I'm trying the below. >> >> func Som

Re: [go-nuts] How can I get running func name?

2016-07-13 Thread Jan Mercl
On Wed, Jul 13, 2016 at 1:48 PM Harry wrote: > If I could get func name automatically, same code can be used. https://play.golang.org/p/XjDcnK78xY -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] How can I get running func name?

2016-07-13 Thread 'Axel Wagner' via golang-nuts
https://godoc.org/runtime#Caller https://godoc.org/runtime#FuncForPC On Wed, Jul 13, 2016 at 1:48 PM, Harry wrote: > Hello, everyone. > > As title, I'm trying the below. > > func SomethingFunc() { > fmt.Printf("func is %s\n", funcName) > /* code */ > } > > I want to show func name when runni

[go-nuts] How can I get running func name?

2016-07-13 Thread Harry
Hello, everyone. As title, I'm trying the below. func SomethingFunc() { fmt.Printf("func is %s\n", funcName) /* code */ } I want to show func name when running each func. If I could get func name automatically, same code can be used. Thank you. Harry. -- You received this message becaus

Re: [go-nuts] Rel in path package

2016-07-13 Thread Anmol Sethi
Right here: https://github.com/nsf/gocode/blob/f535dc686130fcc7b942c504ce5903222a205ca3/autocompletecontext.go#L254 I have to annoyingly use filepath.ToSlash after just in case the user was on windows. > On Jul 12, 2016, at 10:58 PM, Ian Lance Taylor wrote: > > On Tue, Jul 12, 2016 at 5:17 PM,

Re: [go-nuts] Plurality of package naming

2016-07-13 Thread Nathan Fisher
struct and class semantics aren't equivalent but they are similar. Which is why I think the rule "avoid -er" is relevant. If you're struggling to name something then you probably don't know what it is and what it needs to do. I'm not advocating going to the Java extreme of fifty syllable names. Ra