Re: [go-nuts] GO lang implementation for one deck card shuffle

2018-08-15 Thread Pat Farrell
On Thursday, August 16, 2018 at 12:51:19 AM UTC-4, Rob 'Commander' Pike wrote: > > The math/rand package has 38848 bits of state. The seed value is only 64 > bits, yes, but that's a separate question. Is seeding what you are > concerned with? > Oh, that is good news. I didn't see that in the

Re: [go-nuts] question regarding unix.IoctlSetInt()

2018-08-15 Thread Ian Lance Taylor
On Wed, Aug 15, 2018 at 11:07 AM, Peter Morjan wrote: > > https://godoc.org/golang.org/x/sys/unix#IoctlSetInt > > func IoctlSetInt(fd int, req uint, value int) error > > > From the function definition and function description I would expect that > the last parameter "value" can be a regular int

Re: [go-nuts] Why "strings" package exists ?

2018-08-15 Thread Kevin Malachowski
Well, the 'error' type has a method. But none of the other primitives do. -- 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

Re: [go-nuts] GO lang implementation for one deck card shuffle

2018-08-15 Thread Rob Pike
The math/rand package has 38848 bits of state. The seed value is only 64 bits, yes, but that's a separate question. Is seeding what you are concerned with? -rob On Thu, Aug 16, 2018 at 1:19 PM, Pat Farrell wrote: > I want to build a poker simulator. For this, I need a nice method to > shuffle

Re: [go-nuts] Re: Extending deadline for logging

2018-08-15 Thread Dave Cheney
What would happen if you write the error to spanner with a setting context.Backgrond(), ie, no deadline? On 16 August 2018 at 13:57, Robert Bartoszynski wrote: > Thanks. Perhaps an alternative would be for me to create a child context > with a deadline of (context - x seconds) and pass that to

Re: [go-nuts] Re: Extending deadline for logging

2018-08-15 Thread 'Robert Bartoszynski' via golang-nuts
Thanks. Perhaps an alternative would be for me to create a child context with a deadline of (context - x seconds) and pass that to OtherService, with the expectation that there should be x seconds left over for the write to spanner. On Wed, Aug 15, 2018 at 8:10 PM Dave Cheney wrote: > > > On

Re: [go-nuts] Limit goroutine resource usage?

2018-08-15 Thread andrey mirtchovski
it seems from your suggested solutions that you're concerned about cpu usage. does the goroutine communicate with anything? you can limit its resources by feeding it less data (via a limiter goroutine) or by editing it itself do less work (via editing the code)? there is nothing inherently needed

[go-nuts] Decoding the buffer to a struct sent from C program

2018-08-15 Thread naveen . b . neelakanta
Hi All, I am learning golang and in the process i am trying to decode the buffer sent from a C client to a structure in golang. however that fails , please guide me through the process. The communication uses UNIX domain socket, between a c program and a golang process. C structure. struct

[go-nuts] question regarding unix.IoctlSetInt()

2018-08-15 Thread Peter Morjan
https://godoc.org/golang.org/x/sys/unix#IoctlSetInt func IoctlSetInt(fd int , req uint , value int ) error >From the function definition and function description I

[go-nuts] Limit goroutine resource usage?

2018-08-15 Thread Olivia Nelson
I'm trying to limit the CPU usage of a goroutine. Is there anything like SuspendThread on windows and SIGSTOP/SIGCONTINUE on linux? I'm not sure if it's possible. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

[go-nuts] Server RAM size as a function of the number of goroutines???

2018-08-15 Thread faizan10114
Hi everyone, I am writing a CLI based golang programme which will run traceroute command for a range of IPs. Sometimes a range will include 63*256*256 ips, which is close to 4 million IPs. Each traceroute runs in a goroutine and then there is a watcher goroutines that acts on the console

[go-nuts] GO lang implementation for one deck card shuffle

2018-08-15 Thread Pat Farrell
I want to build a poker simulator. For this, I need a nice method to shuffle cards. A bit of googling shows that a good basic approach is the Fisher-Yates shuffle. Its O(n) and space efficient. But it depends on the quality of the PRNG. I am specifically concerned that the math/rand is only

[go-nuts] Re: Extending deadline for logging

2018-08-15 Thread Dave Cheney
On Thursday, 16 August 2018 12:15:57 UTC+10, r...@google.com wrote: > > As an example: > Client calls MyService with a deadline of 10 seconds. > MyService calls OtherService as part of responding. However, the call to > OtherService times out due to the deadline in 10 seconds. > MyService tries

Re: [go-nuts] Ternary ... again

2018-08-15 Thread Nathan Youngman
Mark, Funny that -- you suggest that adding another syntax for the same behaviour "might help with adoption". I think the opposite is true. My friend has been learning iOS development and has found many things confusing. There is the lambda syntax in Swift, and then the trailing lambda

[go-nuts] Re: Extending deadline for logging

2018-08-15 Thread rbz via golang-nuts
As an example: Client calls MyService with a deadline of 10 seconds. MyService calls OtherService as part of responding. However, the call to OtherService times out due to the deadline in 10 seconds. MyService tries to log the error to Spanner; but it's still using that context deadline which

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-15 Thread maksach
err = out.Close() if err != nil { fmt.Println(err) } When I add this code after the io.Copy line, it gives me this error (attached screenshot to the email). It says upload multipart failed, failed to compute body hashes, and file already closed. I moved both the file.Close() and out.Close()

[go-nuts] x/net: Tag submodules with version numbers

2018-08-15 Thread Liam
I need to add x/net/ipv4 to [project]/vendor. I append a version ID to everything I vendor. I could not find a version number for x/net or x/net/ipv4. If none exists, could the maintainers start committing version tags for each submodule in golang.org/x -- i.e. x/*/* (or x/* if no submodules)?

Re: [go-nuts] Re: Does the ecosystem need a standard interface for vector graphic?

2018-08-15 Thread George Moschovitis
What about golang.org/x/graphics/vector ? On Wed, 15 Aug 2018 at 20:05, Robert Johnstone wrote: > Agreed. image/vector would be better, but it would conflict with the > existing golang.org/x/image/vector > > > On Tuesday, 14 August 2018 18:45:58 UTC-4, George Moschovitis wrote: >> >> A general

[go-nuts] Re: Does the ecosystem need a standard interface for vector graphic?

2018-08-15 Thread Robert Johnstone
Agreed. image/vector would be better, but it would conflict with the existing golang.org/x/image/vector On Tuesday, 14 August 2018 18:45:58 UTC-4, George Moschovitis wrote: > > A general interface would be extremely useful (at least to me ;-). > I am not sure about the postscript-based API (I

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-15 Thread 'Ingo Oeser' via golang-nuts
You seem to ignore the error from out.Close() What is out.Close reporting after the io.Copy? -- 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

[go-nuts] Re: Go modules and semver question

2018-08-15 Thread jake6502
The initial premise was that the API and "Behavior" have not changed. What this means for the literal API is pretty clear - that public function signatures and such are unchanged. "Behavior" is a bit more tricky and subjective. If you define "behavior" is the strictest possible sense, then

Re: [go-nuts] Re: Ternary ... again

2018-08-15 Thread Michael Jones
Mark, Some considerations that may be unclear when approaching Go and considering anything familiar from other languages that is not in Go... MAKING DECISIONS Go's designers are experienced. with central roles in UNIX, C, GCC, Modula, etc., and also across teams of various scales and

[go-nuts] Re: Ternary ... again

2018-08-15 Thread Tamás Gulácsi
2018. augusztus 15., szerda 16:46:51 UTC+2 időpontban Hoo Luu a következőt írta: > > 在 2018年8月15日星期三 UTC+8上午12:43:37,Mark Volkmann写道: > >> var color = temperature > 100 ? “red” : “blue” > > > Although this feature will not be accepted, we could just talk about it. I > prefer

[go-nuts] Re: Go modules and semver question

2018-08-15 Thread 'meta keule' via golang-nuts
I am not thinking of a certain package. The singleton problem is just one example. I'll give you another one: Let's say my library is a porcelain lib for creating PDFs, that is using under the hood anthoer library that does the real work. So some of the resulting PDF files look different

[go-nuts] Re: Ternary ... again

2018-08-15 Thread Tamás Gulácsi
2018. augusztus 15., szerda 16:46:51 UTC+2 időpontban Hoo Luu a következőt írta: > > 在 2018年8月15日星期三 UTC+8上午12:43:37,Mark Volkmann写道: > >> var color = temperature > 100 ? “red” : “blue” > > > Although this feature will not be accepted, we could just talk about it. I > prefer

[go-nuts] Re: Ternary ... again

2018-08-15 Thread Hoo Luu
在 2018年8月15日星期三 UTC+8上午12:43:37,Mark Volkmann写道: > var color = temperature > 100 ? “red” : “blue” Although this feature will not be accepted, we could just talk about it. I prefer 'if-expression' to ternary. var color = if temperature > 100 { "red" } else { "blue" } vs. current if

[go-nuts] Re: Ternary ... again

2018-08-15 Thread Hoo Luu
在 2018年8月15日星期三 UTC+8上午12:43:37,Mark Volkmann写道: > > var color = temperature > 100 ? “red” : “blue” > Although this feature will not be accepted, we could just talk about it. I prefer 'if-expression' to ternary. var color = if temperature > 100 { "red" } else { "blue" } vs. current if

Re: [go-nuts] Ternary ... again

2018-08-15 Thread Volker Dobler
On Wednesday, 15 August 2018 13:23:36 UTC+2, Mark Volkmann wrote: > > [...] > The first is ternaries. What if only simple, non-nested ternaries were > supported? For example, color := temperature > 100 ? “red” : “blue”. > It is easy to write "non-nested" but it is hard to define. Probably

[go-nuts] Re: `go test -c` skips init from main while `go test` doesn't

2018-08-15 Thread Gert
I made a wrong conclusion and run a executable not representing the build because it failed so it didn't replaced the old executable. Unrelated with the title I am a bit confused why it didn't build in the first place? Thanks. go build -a -tags 'netgo noplugin' -ldflags '-d -extldflags

Re: [go-nuts] Ternary ... again

2018-08-15 Thread 'Axel Wagner' via golang-nuts
Hi, On Wed, Aug 15, 2018 at 1:23 PM Mark Volkmann wrote: > I understand that many requests for syntax additions are rejected on two > grounds. Really though, the reaction always happens on the same grounds: It is not shown that the benefit outweighs the cost. You mention the cost in your

Re: [go-nuts] Ternary ... again

2018-08-15 Thread peterGo
Mark, "Adding just a few things like these to the language might help with adoption and that in itself is a worthwhile goal. I suspect many developers that love Go aren’t currently using it on real projects. Getting more developers to consider Go makes that more likely." There are several

Re: [go-nuts] Re: Go modules and semver question

2018-08-15 Thread 'Axel Wagner' via golang-nuts
True. That depends a lot on what package we are talking about. You can check whether that is the case for the specific package in question. Have a look at the "Avoiding Singleton Problems" section of Russ' article. IMO it is the responsibility of the package author to make sure, that different

Re: [go-nuts] Ternary ... again

2018-08-15 Thread Mark Volkmann
I realize I’m just another new person to Go asking for features that have been discussed many times before and that are very unlikely to be changed. But I’d like to consider a kind of middle ground that applies to many potential features. I understand that many requests for syntax additions

[go-nuts] Re: Go modules and semver question

2018-08-15 Thread 'meta keule' via golang-nuts
Well on the other hand, if the user has the same dependency imported in the previous version, there might be surpising effects happening, because she now has two different incompatible versions of the same package. If the package is having some init functions that should only be run once

Re: [go-nuts] Go modules and semver question

2018-08-15 Thread 'Axel Wagner' via golang-nuts
Neither API nor Behavior of your module has changed, so it's definitionally a patch release. Go modules have an explicit design goal to enable using multiple major versions of a module in the same binary. i.e. your situation is basically what's described here as a motivation for semantic import

[go-nuts] Go modules and semver question

2018-08-15 Thread 'meta keule' via golang-nuts
Hi, playing around with the go modules, I wondered: Let's say, my library gets a compatible update. The only thing that changes is, I have updated a dependency to an incompatible major version and changed the internal library code accordingly. However the behavior and API of my library did

Re: [go-nuts] Re: Ternary ... again

2018-08-15 Thread 'Axel Wagner' via golang-nuts
In my opinion Python serves as a poor argument here. I tend to use Python as a example of a grab-bag language that adds any feature anyone considers useful - without considering the cost. An Anti-Go, if you will :) Gustavo Niemeyer actually wrote this up pretty well:

Re: [go-nuts] Re: Ternary ... again

2018-08-15 Thread Sam Vilain
I haven't seen all the discussion referenced, but I remember digging deep into the python language archives where Guido and others eventually relented and added ternaries (with the syntax "a if val else b"). I can't remember the argument which swung the consensus but the arguments against seem

[go-nuts] Immutable variables through special pointers

2018-08-15 Thread Lucio
I recall that a long time ago there was serious discussion about making Go variables read-only and the final outcome was negative. I could not follow all the different facets involved (probably couldn't these days, either), but it struck me recently that at least partial immutability for