[go-nuts] Re: network programming about go

2017-11-05 Thread 2891132love
Sorry, the last program is about server.and the following program is about the client: package main import ( "fmt" "net" "os" ) func main() { var buf [512]byte if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "usage:%s host:port", os.Args[0]) } service := os.Args[1] tcpAddr, err :

[go-nuts] [Request] Official golang debugger

2017-11-05 Thread Sotirios Mantziaris
Hi, with the lack of a official debugger, i am using delve. It is very nice and get the work done mostly, needs little or a lot of polishing. Is there any plan to provide a official debugger which will be distributed with the releases? Maybe delve could make it as the official one? Do not get

[go-nuts] Re: Passing a string

2017-11-05 Thread Tamás Gulácsi
2017. november 6., hétfő 2:11:48 UTC+1 időpontban Chun Zhang a következőt írta: > > Hi, All, > > I am trying to read a configuration file using Viper, the config file is a > very simple json file with one line > { > "device" : "eth1" > } > > I use the following line to read it > > device := vi

[go-nuts] Re: append to a stem racy?

2017-11-05 Thread Tamás Gulácsi
What if you use stem[:len(stem):len(stem)] as the stem? -- 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 option

Re: [go-nuts] Rationale in docs on why you need to use the result of append()

2017-11-05 Thread Dave Cheney
I think #1 would be clearer if it were written as 1) "We must return the slice afterwards because ... the our slice value (the run-time data structure holding the pointer, length, and capacity) is a copy of the callers.” -- You received this message because you are subscribed to the Google Gro

[go-nuts] Passing a string

2017-11-05 Thread Chun Zhang
Hi, All, I am trying to read a configuration file using Viper, the config file is a very simple json file with one line { "device" : "eth1" } I use the following line to read it device := viper.GetString("device") then passing this var further into a C library with swig generated api as ar

Re: [go-nuts] append to a stem racy?

2017-11-05 Thread Dan Kortschak
With high N, I have been able to confirm raciness. On Mon, 2017-11-06 at 11:13 +1030, Dan Kortschak wrote: > I have not been able to get the race detector to complain about this, > even if I make len << cap. -- You received this message because you are subscribed to the Google Groups "golang-

[go-nuts] append to a stem racy?

2017-11-05 Thread Dan Kortschak
Say I have a []T that I want to use as a common stem that has a tail appended onto it, used concurrently, for example: for i := 0; i < N; i++ { tail := makeTail(i) // Returns a []T. wg.Add(1) go func() { defer wg.Done() a := append(stem, tail

RE: [go-nuts] Converting uint to string

2017-11-05 Thread John Souvestre
You could also just the integers themselves as keys. John John Souvestre - New Orleans LA From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of Chun Zhang Sent: 2017 November 05, Sun 15:09 To: golang-nuts Subject: [go-nuts] Converting uint to string

Re: [go-nuts] Converting uint to string

2017-11-05 Thread Chun Zhang
Hi, Jan, Thank you very much!! Best, Chun On Sunday, November 5, 2017 at 4:17:43 PM UTC-5, Jan Mercl wrote: > > On Sun, Nov 5, 2017 at 10:09 PM Chun Zhang > wrote: > > > I have a group of integers ranging from 1 to 2^32 that are in the format > of uint32. > > Assuming you mean 'to 2^32-1'. >

Re: [go-nuts] Converting uint to string

2017-11-05 Thread Jan Mercl
On Sun, Nov 5, 2017 at 10:09 PM Chun Zhang wrote: > I have a group of integers ranging from 1 to 2^32 that are in the format of uint32. Assuming you mean 'to 2^32-1'. > However, I am wondering if I use string(i) only, will I get any two numbers the same string representation? My guess is no, bu

[go-nuts] Converting uint to string

2017-11-05 Thread Chun Zhang
Hi, All, I have a group of integers ranging from 1 to 2^32 that are in the format of uint32. I know strconv.Itoa(i) or strconv.FormatUint(i) can definitely give unique representation of each number. So, I can use it as the index of a map[string]interface{}. However, I am wondering if I use st

Re: [go-nuts] Is something like SIMD "math/vector" planned?

2017-11-05 Thread Sebastien Binet
David, I think the plan is to gather experience with math/bits and then devise something along the lines of a package that could do vectorized operations. (Also avx1/2 should be in 1.10 so there's that.) -s sent from my droid On Nov 5, 2017 5:20 PM, "David M." wrote: > Hi, > > I'm interested

Re: [go-nuts] Expected ambigiuous reference error, got a value instead

2017-11-05 Thread Jan Mercl
I consider foo.bar and f.b to be of the same length, as in length of a list, 2 in this case, not length of a string. But I failed to be clear about it. On Sun, Nov 5, 2017, 17:38 Daniel Skinner wrote: > > I don't know when the shallowest depth can occur while not being on > shortest path > > I k

Re: [go-nuts] Expected ambigiuous reference error, got a value instead

2017-11-05 Thread Daniel Skinner
> I don't know when the shallowest depth can occur while not being on shortest path I know the feeling if we're generally talking about data structures and algorithms, but with regards to language spec, the only mental reference I have for "path" is for "import paths" of which the actual name is i

Re: [go-nuts] who does go compiler link executable to glibc without an apparent reason?

2017-11-05 Thread Jan Mercl
Using some of the net/... package calls libc unless disabled. On Sun, Nov 5, 2017, 17:13 Howard Guo wrote: > Hello fellow gophers. > > I've a small number of go programs that only use standard library > functions without any 3rd party library dependency. A strange behaviour was > observed during

[go-nuts] Is something like SIMD "math/vector" planned?

2017-11-05 Thread David M.
Hi, I'm interested in high performance applications in Go, and I saw the new "math/bits" package. I think it's very nice that the compiler replaces the Go implementation with special CPU instructions when the architecture supports it. My question is, is there a plan to do something similar wit

[go-nuts] who does go compiler link executable to glibc without an apparent reason?

2017-11-05 Thread Howard Guo
Hello fellow gophers. I've a small number of go programs that only use standard library functions without any 3rd party library dependency. A strange behaviour was observed during compilation (go build) - most of them compile into static executable, but few of them end up linking to glibc. With

Re: [go-nuts] Expected ambigiuous reference error, got a value instead

2017-11-05 Thread Jan Mercl
I don't know when the shallowest depth can occur while not being on shortest path. Note that path was used in this discussion as meaning full, unpromoted path, ie. like if every embedded field of type T was declared T T instead. The actual selector expression is a prefix of this full path. On Sun

Re: [go-nuts] Expected ambigiuous reference error, got a value instead

2017-11-05 Thread Daniel Skinner
The spec uses "shallowest depth", not "shortest path", as I assume saying "path" would imply the given names in a selector expression determine ambiguity when they do not. "shallowest depth" makes the error more clear in my sample where if this: type Uniform GLUniform is changed to this: type U

Re: [go-nuts] Rationale in docs on why you need to use the result of append()

2017-11-05 Thread Tamás Gulácsi
Both reasons correct: the underlying array, length and cap may change, and as all arguments are pasded by value, we can't see the change if we don't use (assign) the returned value. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] Rationale in docs on why you need to use the result of append()

2017-11-05 Thread Ben Hoyt
> > I don't follow. It had been shown, that the result of append is actually > not needed/can be constructed by other means - except in the case where the > backing array gets reallocated. Then you can't get away without it. > Hmmm, it feels like we're talking past each other. Of course you can ig

[go-nuts] Re: goroutines with better exceptions

2017-11-05 Thread Tamás Gulácsi
yes -- 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/optout.

[go-nuts] Re: goroutines with better exceptions

2017-11-05 Thread Keith Brown
sure, in line 16. So, don't continue means I can do this? ch <- Result{500} return On Saturday, November 4, 2017 at 5:26:37 PM UTC-4, Tamás Gulácsi wrote: > > If err!=nil, response is nil, too - so don't continue! -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Rationale in docs on why you need to use the result of append()

2017-11-05 Thread Jan Mercl
On Sun, Nov 5, 2017 at 3:16 AM Ben Hoyt wrote: > Hence the confusion. Sure, append can write to the underlying array because that's effectively passed by reference. But it can't update the length of the slice itself, unless you return it. I don't follow. It had been shown, that the result of app