Re: [go-nuts] Re: ActiveState seeking Go community feedback

2017-02-21 Thread Konstantin Khomoutov
On Mon, 20 Feb 2017 12:50:32 -0800 (PST) Kevin Powick wrote: [...] > I'm not really up on Activestate's involvement with Go, but have they > contributed to the development or promotion of Go in any significant > way? I'm not up with their involvement in Go as well, but I know about their involv

[go-nuts] Re: unexpected end of JSON input while unmarshal to struct

2017-02-21 Thread Nathan Kerr
I figured it out. First off, the posted playground had a different json string and did not use your UnmarshalJSON function. These made translating between the non-working setup described in your post and the working playground annoying. In the future, share the non-working setup. At the point

Re: [go-nuts] Does Go spec assure that a substring shares the underlying bytes with the original string?

2017-02-21 Thread T L
On Tuesday, February 21, 2017 at 1:30:24 AM UTC+8, Ian Lance Taylor wrote: > > On Mon, Feb 20, 2017 at 9:12 AM, T L > > wrote: > > > > I know gc assures this, but I don't know if it is compiler specified or > a > > spec rule. > > I can't think of any way that a Go program that does not unsa

Re: [go-nuts] Does Go spec assure that a substring shares the underlying bytes with the original string?

2017-02-21 Thread 'Axel Wagner' via golang-nuts
On Tue, Feb 21, 2017 at 9:30 AM, T L wrote: > > > On Tuesday, February 21, 2017 at 1:30:24 AM UTC+8, Ian Lance Taylor wrote: >> >> On Mon, Feb 20, 2017 at 9:12 AM, T L wrote: >> > >> > I know gc assures this, but I don't know if it is compiler specified or >> a >> > spec rule. >> >> I can't thin

Re: [go-nuts] How to Build and Install Go 1.7.4 in OpenBSD 5.9

2017-02-21 Thread Srikanth Chandika
Thanks for the valuable information. Go fully built. I ran ./all.bash repeatedly for 5 to 6 times somehow all tests are successfully completed. And my requirement fulfilled. On Tuesday, February 21, 2017 at 12:39:35 PM UTC+5:30, Dave Cheney wrote: > > It looks like one test in the os/exec packa

Re: [go-nuts] How to Build and Install Go 1.7.4 in OpenBSD 5.9

2017-02-21 Thread Srikanth Chandika
I am sorry I forgot to mention that I have built go1.8 instead of go-1.7, this thread subject says go-1.7 On Tuesday, February 21, 2017 at 2:20:16 PM UTC+5:30, Srikanth Chandika wrote: > > Thanks for the valuable information. > > Go fully built. > I ran ./all.bash repeatedly for 5 to 6 times so

[go-nuts] History: Does the _ (Blank identifier) trace its history back to VI's or something earlier?

2017-02-21 Thread 'pfitzsimons' via golang-nuts
The _ is used as the https://golang.org/ref/spec#Blank_identifier to ignore right-hand side values in an assignment (https://golang.org/ref/spec#Assignments) In VI(M) _ is used as a black hole register http://vimdoc.sourceforge.net/htmldoc/change.html#registers when you want to delete clipboar

[go-nuts] Re: Import path search order?

2017-02-21 Thread Nathan Kerr
Relative package don't need to be searched for, they are explicit (indicated with ./ or ../) Then it seems to be: 1. vendor tree, if it exists 2. GOROOT 3. GOPATH, from left to right Trying to build a package with an import that cannot be found will display an error listing all the locations i

[go-nuts] Syscall trouble with parameter handling

2017-02-21 Thread snmed
Hi all I try to use the syscall package to call a native Windows API and struggling with the call parameters. I calling the api HRESULT WINAPI AmsiInitialize( _In_ LPCWSTR appName, _In_ DWORDcoInit, _Out_ HAMSICONTEXT *amsiContext ); my test app looks like this package mai

Re: [go-nuts] History: Does the _ (Blank identifier) trace its history back to VI's or something earlier?

2017-02-21 Thread Konstantin Khomoutov
On Tue, 21 Feb 2017 01:16:08 -0800 (PST) "'pfitzsimons' via golang-nuts" wrote: > The _ is used as the https://golang.org/ref/spec#Blank_identifier to > ignore right-hand side values in an assignment > (https://golang.org/ref/spec#Assignments) > > In VI(M) _ is used as a black hole register >

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-21 Thread Nathan Kerr
Could you give an example of the json you are starting from? Also, what database are you using? On Sunday, February 19, 2017 at 8:27:32 AM UTC+1, Bharath B wrote: > > Hi, > > I am trying to read those values and store in DB. > > Regards, > Bharath B > -- You received this message because you ar

[go-nuts] Re: Syscall trouble with parameter handling

2017-02-21 Thread brainman
According to the doco https://msdn.microsoft.com/en-us/library/windows/desktop/dn889862(v=vs.85).aspx ``` Return value If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. ``` Your call returns 2147942487, and it is not S_OK. It must be the error code. You ne

Re: [go-nuts] Re: Go UDP performance

2017-02-21 Thread Marcus Franke
Hi, an additional note, don't forget to monitor the netstat udp counter on both servers. % netstat -auns | grep -A 7 "Udp:" Udp: 9381 packets received 0 packets to unknown port received 0 packet receive errors 1009 packets sent 0 receive buffer errors 0 send buffer errors

Re: go test -race much slower in 1.8 (was Re: [go-nuts] Go 1.8 is released)

2017-02-21 Thread Will Newton
On Mon, Feb 20, 2017 at 8:23 PM, Ian Lance Taylor wrote: > On Mon, Feb 20, 2017 at 12:06 PM, Will Newton wrote: >> On Thu, Feb 16, 2017 at 9:01 PM, Chris Broadfoot wrote: >>> Hello gophers, >>> >>> We just released Go 1.8. >>> >>> You can read the announcement blog post here: >>> https://blog.

[go-nuts] Re: Syscall trouble with parameter handling

2017-02-21 Thread snmed
Ohh strange i missed that, i thought it's S_OK because the error stated "The operation completed successfully". So i need to find out why it is failling, do you have any idea about the reason? Cheers snmed Am Dienstag, 21. Februar 2017 11:16:08 UTC+1 schrieb brainman: > > According to the doc

[go-nuts] Re: Syscall trouble with parameter handling

2017-02-21 Thread snmed
okay it says "E_INVALIDARGOne or more arguments are not valid 0x80070057", but what i am doing wrong with the parameters? Am Dienstag, 21. Februar 2017 12:01:47 UTC+1 schrieb snmed: > > Ohh strange i missed that, i thought it's S_OK because the error stated > "The operation completed

[go-nuts] Re: Go Concurrency Patterns: Pipelines

2017-02-21 Thread Tamás Gulácsi
You should benchmark, but md5 is not cpu hungry at all, so the disk read speed will dominate. That means 2*runtime.NumCPU disk-reading goroutines is a good rule of thumb. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Re: Go UDP performance

2017-02-21 Thread anupam . kapoor
> "Franke" == Marcus Franke writes: ,[ Franke ] | an additional note, don't forget to monitor the netstat udp counter on both | servers. | | % netstat -auns | grep -A 7 "Udp:" | Udp: | 9381 packets received | 0 packets to unknown port received | 0 packet receive errors | 1009 packets sent

Re: [go-nuts] Go UDP performance

2017-02-21 Thread Konstantin Khomoutov
On Mon, 20 Feb 2017 13:02:15 -0800 Tharaneedharan Vilwanathan wrote: > Hi All, > > I am trying to send a lot of UDP packets from Go code but I realized > UDP performance is too low. The max I was able to do is about > 160Mbps. This is in Ubuntu 16.10 on x86_64 (i7-6700HQ). > > I tried to google

Re: go test -race much slower in 1.8 (was Re: [go-nuts] Go 1.8 is released)

2017-02-21 Thread peterGo
Will, "it looks like the plan is to fix this in Go 1.9 rather than 1.8.x, is that the case? " What makes you think that? https://github.com/golang/go/issues/19151: Milestone Go1.8.1 https://github.com/golang/go/issues/19133: Milestone Go1.8.1 Peter On Tuesday, February 21, 2017 at 5:41:25 AM

[go-nuts] Interfaces in Go (part II) - type assertion & type switch

2017-02-21 Thread Michał Łowicki
https://medium.com/golangspec/interfaces-in-go-part-ii-d5057ffdb0a6 -- 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

[go-nuts] Re: Can anyone provide an example or stopping and/or starting an established Windows service?

2017-02-21 Thread akcorr
Sorry. Yes, The package is up to date. I did a 'go get' on the package on Feb 17. I'm running version 1.73. Will get on with gdb. Thanks for your help! I really appreciate it! On Saturday, February 18, 2017 at 6:05:57 AM UTC-5, Egon wrote: > > Just checking whether I got my message across

[go-nuts] Re: Can anyone provide an example or stopping and/or starting an established Windows service?

2017-02-21 Thread Tamás Gulácsi
A working windows service example is at https://github.com/tgulacsi/agostle/blob/master/main_windows.go -- 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-nu

Re: go test -race much slower in 1.8 (was Re: [go-nuts] Go 1.8 is released)

2017-02-21 Thread Will Newton
On Tue, Feb 21, 2017 at 11:56 AM, peterGo wrote: > Will, > > "it looks like the plan is to fix this in Go 1.9 rather than 1.8.x, is that > the case? " What makes you think that? > > https://github.com/golang/go/issues/19151: Milestone Go1.8.1 > > https://github.com/golang/go/issues/19133: Mileston

[go-nuts] Re: Import path search order?

2017-02-21 Thread so . query
Thanks! what do you mean by "from left to right"? And by GOROOT, you mean it looks at the go source? On Tuesday, February 21, 2017 at 1:27:59 AM UTC-8, Nathan Kerr wrote: > > Relative package don't need to be searched for, they are explicit > (indicated with ./ or ../) > > Then it seems to be

[go-nuts] Cannot decrypt rsa.EncryptOAEP messages with openssl

2017-02-21 Thread John-Paul Bader
Hello, I have the following code where I'm loading an RSA pub key to encrypt a message and write it to a file. https://play.golang.org/p/qr6BfWVuHB Then I'm trying to decrypt it with the following openssl command: openssl rsautl -decrypt -inkey private.pem -oaep -in cryptedmessage -out decr

[go-nuts] Go Compiler Intermediate Representation

2017-02-21 Thread Arpit Aggarwal
Hi all, I am doing a project in which I need Go compiler's intermediate representation(IR) (which is semantics preserving and I can get all all info like line number and data type and other features) (human readable) to convert to another IR of a tool. I am new to Golang. Can anybody tell me how

Re: [go-nuts] Go Compiler Intermediate Representation

2017-02-21 Thread Arpit Aggarwal
Thanks a lot *Ian*. Will try it and ask if I have any further doubts. Thanks, Arpit On Tuesday, February 21, 2017 at 10:59:41 PM UTC+5:30, Ian Lance Taylor wrote: > > On Tue, Feb 21, 2017 at 9:15 AM, Arpit Aggarwal > wrote: > > > > I am doing a project in which I need Go compiler's intermedia

Re: [go-nuts] Go Compiler Intermediate Representation

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 9:15 AM, Arpit Aggarwal wrote: > > I am doing a project in which I need Go compiler's intermediate > representation(IR) (which is semantics preserving and I can get all all info > like line number and data type and other features) (human readable) to > convert to another IR

[go-nuts] ANN: checkxml package for validating XML data using struct definitions.

2017-02-21 Thread C Banning
The checkxml package [1] extends the mxj package [2] to validate XML data using go struct definitions. [1] https://github.com/clbanning/checkxml [2] https://github.com/clbanning/mxj -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Manlio Perillo
I have noted that the intValue (and uintValue) Set method do the following: v, err := strconv.ParseInt(s, 0, 64) However this is incorrect on 32 bit systems: https://play.golang.org/p/tvAUCI63x3 Can this be considered a bug? Another, minor, issue is that: *i = intValue(v) return err i is se

[go-nuts] Re: Import path search order?

2017-02-21 Thread Nathan Kerr
GOPATH is a list , though it usually only contains one element. The first element in the list is the leftmost one (e.g., GOPATH=first:second:last). GOROOT holds the standard library, so those packages must be findable. The standard li

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Alexander Kapshuk
On Tue, Feb 21, 2017 at 7:51 PM, Manlio Perillo wrote: > I have noted that the intValue (and uintValue) Set method do the following: > v, err := strconv.ParseInt(s, 0, 64) > > However this is incorrect on 32 bit systems: > https://play.golang.org/p/tvAUCI63x3 > > Can this be considered a bug?

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-21 Thread 'Thomas Bushnell, BSG' via golang-nuts
On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor wrote: > On Sun, Feb 19, 2017 at 2:57 PM, wrote: > > Thanks, I see you build it up with decorators on a standard prototype. > > For example: https://play.golang.org/p/PJy5lE9QqF > > > > So context.Done is a convenience function for those that re

Re: [go-nuts] History: Does the _ (Blank identifier) trace its history back to VI's or something earlier?

2017-02-21 Thread Wim Lewis
If I had to speculate, I'd guess that the use of "_" for an anonymous or blank identifier in pattern matching and destructuring traces back to Prolog. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop recei

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Alexander Kapshuk
On Tue, Feb 21, 2017 at 9:13 PM, Alexander Kapshuk wrote: > On Tue, Feb 21, 2017 at 7:51 PM, Manlio Perillo > wrote: >> I have noted that the intValue (and uintValue) Set method do the following: >> v, err := strconv.ParseInt(s, 0, 64) >> >> However this is incorrect on 32 bit systems: >> htt

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-21 Thread 'Axel Wagner' via golang-nuts
Wrong list :) You meant to link here: https://godoc.org/context#Context.Err On Tue, Feb 21, 2017 at 8:15 PM, 'Thomas Bushnell, BSG' via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor wrote: > >> On Sun, Feb 19, 2017 at 2:57 PM, wrote: >>

Re: [go-nuts] History: Does the _ (Blank identifier) trace its history back to VI's or something earlier?

2017-02-21 Thread Rob Pike
Perhaps, but in Go it's just the shortest name that looks meaningless. Nothing inspired it but brevity. -rob On Tue, Feb 21, 2017 at 11:25 AM, Wim Lewis wrote: > If I had to speculate, I'd guess that the use of "_" for an anonymous or > blank identifier in pattern matching and destructuring tr

[go-nuts] Re: Import path search order?

2017-02-21 Thread so . query
Thanks for the clarification! On Tuesday, February 21, 2017 at 10:00:41 AM UTC-8, Nathan Kerr wrote: > > GOPATH is a list > , though it > usually only contains one element. The first element in the list is the > leftmost one (e.g., GO

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 11:15 AM, Thomas Bushnell, BSG wrote: > On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor wrote: >> >> On Sun, Feb 19, 2017 at 2:57 PM, wrote: >> > Thanks, I see you build it up with decorators on a standard prototype. >> > For example: https://play.golang.org/p/PJy5lE9Q

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 12:45 PM, Ian Lance Taylor wrote: > On Tue, Feb 21, 2017 at 11:15 AM, Thomas Bushnell, BSG > wrote: >> On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor wrote: >>> >>> On Sun, Feb 19, 2017 at 2:57 PM, wrote: >>> > Thanks, I see you build it up with decorators on a stand

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 9:51 AM, Manlio Perillo wrote: > I have noted that the intValue (and uintValue) Set method do the following: > v, err := strconv.ParseInt(s, 0, 64) > > However this is incorrect on 32 bit systems: > https://play.golang.org/p/tvAUCI63x3 > > Can this be considered a bug?

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-21 Thread 'Thomas Bushnell, BSG' via golang-nuts
Oops! ::blush:: On Tue, Feb 21, 2017 at 11:39 AM Axel Wagner wrote: > Wrong list :) You meant to link here: > https://godoc.org/context#Context.Err > > On Tue, Feb 21, 2017 at 8:15 PM, 'Thomas Bushnell, BSG' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > On Mon, Feb 20, 2017 at 11:

[go-nuts] Re: Trying to understand := and named return values

2017-02-21 Thread andrew . pennebaker
Seems like named returns + if/for/switch initializers = a shadowing nightmare. I wish the Go compiler emitted a loud warning on shadowing, as this is a dangerously subtle problem out there. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To uns

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Manlio Perillo
Il giorno martedì 21 febbraio 2017 22:14:38 UTC+1, Ian Lance Taylor ha scritto: > > On Tue, Feb 21, 2017 at 9:51 AM, Manlio Perillo > > wrote: > > I have noted that the intValue (and uintValue) Set method do the > following: > > v, err := strconv.ParseInt(s, 0, 64) > > > > However this i

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Caleb Spare
Like unsafe.Sizeof? On Tue, Feb 21, 2017 at 1:56 PM, Manlio Perillo wrote: > Il giorno martedì 21 febbraio 2017 22:14:38 UTC+1, Ian Lance Taylor ha > scritto: >> >> On Tue, Feb 21, 2017 at 9:51 AM, Manlio Perillo >> wrote: >> > I have noted that the intValue (and uintValue) Set method do the >>

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Matt Harden
Sizeof does exist in the unsafe package and returns a compile time constant. On Tue, Feb 21, 2017, 13:56 Manlio Perillo wrote: > Il giorno martedì 21 febbraio 2017 22:14:38 UTC+1, Ian Lance Taylor ha > scritto: > > On Tue, Feb 21, 2017 at 9:51 AM, Manlio Perillo > wrote: > > I have noted that t

Re: [go-nuts] Re: Trying to understand := and named return values

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 1:46 PM, wrote: > Seems like named returns + if/for/switch initializers = a shadowing > nightmare. I wish the Go compiler emitted a loud warning on shadowing, as > this is a dangerously subtle problem out there. Yes, named returns may have been a mistake. Only use them i

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Manlio Perillo
Il giorno martedì 21 febbraio 2017 23:00:44 UTC+1, Matt Harden ha scritto: > > Sizeof does exist in the unsafe package and returns a compile time > constant. > > One usually don't want to import the unsafe package just to use the Sizeof function in a safe package. This is the reason why I'm curio

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread andrey mirtchovski
You can try binary.Size but you'll also run into the same problem: int's size is platform specific (binary.Size returns -1 for ints). As the go faq states "For portability, code that relies on a particular size of value should use an explicitly sized type, like int64." -- You received this messag

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Manlio Perillo
On Tue, Feb 21, 2017 at 11:29 PM, andrey mirtchovski wrote: > You can try binary.Size but you'll also run into the same problem: > int's size is platform specific (binary.Size returns -1 for ints). As > the go faq states "For portability, code that relies on a particular > size of value should use

[go-nuts] Unsafe string/slice conversions

2017-02-21 Thread Caleb Spare
I have a program that uses unsafe in order to coerce some slices to strings for use as map keys. (Avoiding these allocations ends up being an important performance optimization to this program.) Here's some example code that shows what I'm doing: https://play.golang.org/p/Yye1Riv0Jj Does this se

[go-nuts] Re: Unsafe string/slice conversions

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 2:53 PM, Caleb Spare wrote: > I have a program that uses unsafe in order to coerce some slices to > strings for use as map keys. (Avoiding these allocations ends up being > an important performance optimization to this program.) > > Here's some example code that shows what

RE: [go-nuts] Re: Trying to understand := and named return values

2017-02-21 Thread John Souvestre
I feel the opposite. I view named returns as documentation of a function's parameters. I'm constantly amazed by the (correct) emphasis placed on using appropriate names for calling parameters, but not for the return parameters. The goal is that I shouldn't have to read a function's code to us

Re: [go-nuts] Re: Trying to understand := and named return values

2017-02-21 Thread prades . marq
Named returns are actually quite useful with panics : https://play.golang.org/p/ZdoZJBN0T1 Le mardi 21 février 2017 23:13:11 UTC+1, Ian Lance Taylor a écrit : > > On Tue, Feb 21, 2017 at 1:46 PM, > > wrote: > > Seems like named returns + if/for/switch initializers = a shadowing > > nightmare

Re: [go-nuts] Re: Trying to understand := and named return values

2017-02-21 Thread 'Paul Borman' via golang-nuts
Named return values are perfectly fine, and I agree, probably should not be discouraged. For example, which is easier to write documentation for? func Run(cmd string) ([]byte, []byte, error) func Run(cmd string) (stdout, stderr []byte, _ error) What is not good is the following function: func

RE: [go-nuts] Re: Trying to understand := and named return values

2017-02-21 Thread John Souvestre
Ø Again, named return values are fine and cause no problems, but naked returns should never have been part of the language (at first they seem useful and cool, but in the end, they cause more problems than they solve). I agree. Perhaps in Go 2? J John John Souvestre - New Orleans

[go-nuts] Re: Syscall trouble with parameter handling

2017-02-21 Thread snmed
Has anyone a hint, what i'm doing wrong with the Call arguments? I think the last parameter is the problematic one, but i can't figure out how to pass that argument. Any help would be most appreciated! Cheers snmed Am Dienstag, 21. Februar 2017 10:36:29 UTC+1 schrieb snmed: > > Hi all > > I tr