[go-nuts] Looking for a way to monitor all active Go channels

2018-08-29 Thread 'Ingo Oeser' via golang-nuts
I would suggest opening an issue for that, if it isn't. A runtime provided profile similar to the contention profile might be very useful here. But that needs careful design. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fro

Re: [go-nuts] Does fmt.Print* automatically render an error string in as struct (play link)

2018-08-29 Thread 'Borman, Paul' via golang-nuts
In your code, anything that implements thing also implements the error interface, which looks just like your thing interface. Printf knows to use the Error method if it is defined. See https://play.golang.org/p/JucIqt9H2FF. You will notice that with your code you can say: var e error = t de

[go-nuts] Re: Unexpected behavior of %+02d in Sprintf() and friends

2018-08-29 Thread Eric Raymond
On Tuesday, August 28, 2018 at 4:49:02 PM UTC-4, peterGo wrote: > > "Width is specified by an optional decimal number immediately preceding > the verb. If absent, the width is whatever is necessary to represent the > value. " > > https://golang.org/pkg/fmt/ > > Width is two. > Thanks for the cla

[go-nuts] More trouble with date formatting

2018-08-29 Thread Eric Raymond
The attached program emits go1.10.1: value '2010-10-27 18:43:32 + +' error on my system. Note the duplicated zone field. Is this expected? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiv

Re: [go-nuts] Re: Unexpected behavior of %+02d in Sprintf() and friends

2018-08-29 Thread 'Borman, Paul' via golang-nuts
Is it possible you used the format string “+%02d” vs “%+02d”? The first will give you the +00 you expected while the second is +0, as discussed. On Aug 29, 2018, at 6:53 AM, Eric Raymond mailto:e...@thyrsus.com>> wrote: On Tuesday, August 28, 2018 at 4:49:02 PM UTC-4, peterGo wrote: "Width is

Re: [go-nuts] Is the go 1.11 godoc tool 'module-aware'?

2018-08-29 Thread Paul Jolly
Please see https://github.com/golang/gddo/issues/567 On Tue, 28 Aug 2018, 18:59 Justin Israel, wrote: > I've been trying out converting some of our internal projects to go 1.11 > using modules instead of glide. We have a build system that provides the > ability to generate html docs via "godoc"

Re: [go-nuts] Re: Unexpected behavior of %+02d in Sprintf() and friends

2018-08-29 Thread Eric Raymond
On Wednesday, August 29, 2018 at 7:57:23 AM UTC-4, Borman, Paul wrote: > > Is it possible you used the format string “+%02d” vs “%+02d”? The first > will give you the +00 you expected while the second is +0, as discussed. > Alas, no. Here's the line from my test program: fmt.Printf("%s: %+02d

[go-nuts] Possible bug in Windows runtime?

2018-08-29 Thread tobykennon via golang-nuts
Hi All I'm seeing intermittent crashes in my unit test and wanted to check here first to see if anyone has suggestions before I filed an official issue. Go version: go1.10.3 windows/amd64 GOPATH: C:\go GOROOT: C:\toolss\go OS: Windows 10 (10.0.17134) Pro Computer: Dell XPS 15 9560 with intel cor

[go-nuts] UnmarshalTypeError does not provide Field name anynmore

2018-08-29 Thread kiteboarder34
I’m using a custom unmarshaler in my code for dedicated types, in case of error my code was returning a json.UnmarhsalTypeError This allowed to retrieve field name where the error occured in case the dedicated type was used within a structure Since I migrated to go1.11, my code do not allow

Re: [go-nuts] More trouble with date formatting

2018-08-29 Thread 'Borman, Paul' via golang-nuts
I put your program onto the playground: https://play.golang.org/p/L0xJgwdLuI3 I notice the output is: go1.10.3: value '2010-10-27 18:43:32 + UTC' error The default format for printing time (it is documented in the Format method on time.Time) is: Mon Jan 2 15:04:05 -0700 MST 2006 Notice t

[go-nuts] Re: Is the go 1.11 godoc tool 'module-aware'?

2018-08-29 Thread wilk
It could be fine to start a wiki page to list the tools and ide (not)ready for modules with the linked issues. In https://github.com/golang/go/wiki/Modules or a new page ? On 29-08-2018, Paul Jolly wrote: > --50127c057491b176 > Content-Type: text/plain; charset="UTF-8" > > Please s

[go-nuts] Re: More trouble with date formatting

2018-08-29 Thread peterGo
Eric, The fmt package verb %v is the value in a default format, typically the String method for the type. func (Time) String func (t Time) String() string String returns the time formatted using the format string "2006-01-02 15:04:05.9 -0700 MST" The returned string is meant for de

Re: [go-nuts] More trouble with date formatting

2018-08-29 Thread peterGo
Paul, The Go Playground sandbox has a few peculiarities, for example for date and time. Results may not match those found in ordinary use. Peter On Wednesday, August 29, 2018 at 9:24:32 AM UTC-4, Borman, Paul wrote: > > I put your program onto the playground: > https://play.golang.org/p/L0xJgw

Re: [go-nuts] Re: Is the go 1.11 godoc tool 'module-aware'?

2018-08-29 Thread Paul Jolly
Perhaps better (because of the automatic linking, status updates etc) is to create issues in respective tools under the umbrella of https://github.com/golang/go/issues/24661 Indeed I know there are a number of such issues, so it's just a case of linking those from #24661. On Wed, 29 Aug 2018 at 07

[go-nuts] Re: Does fmt.Print* automatically render an error string in as struct (play link)

2018-08-29 Thread jake6502
> > I can't find anything saying as such From https://golang.org/pkg/fmt/ : "*4. If an operand implements the error interface, the Error method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any).*" As mentioned in another repl

[go-nuts] gofmt does not recognize "type x = y"

2018-08-29 Thread rajesh nataraja
whereas go compiler recognizes it. Why are the tools not matching? This is with go 1.9.7 gofmt throws the following error expected type, found '=' Thanks Rajesh. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gr

[go-nuts] Re: Looking for a way to monitor all active Go channels

2018-08-29 Thread Ingo Jaeckel
Thanks for the suggestion. I outlined the proposal on https://github.com/golang/go/issues/27347. I agree this needs a careful design. On Wednesday, August 29, 2018 at 2:05:32 AM UTC-7, Ingo Oeser wrote: > > I would suggest opening an issue for that, if it isn't. > > A runtime provided profile

Re: [go-nuts] Re: Is the go 1.11 godoc tool 'module-aware'?

2018-08-29 Thread Justin Israel
Thanks for that update, Paul! On Thu, Aug 30, 2018, 2:07 AM Paul Jolly wrote: > Perhaps better (because of the automatic linking, status updates etc) > is to create issues in respective tools under the umbrella of > https://github.com/golang/go/issues/24661 > > Indeed I know there are a number o

[go-nuts] Golang function(s) returning EINTR due to 3rd party products being linked/used (revisited)

2018-08-29 Thread estess
Although I spent some time searching, I have not found an issue quite like the one I’m experiencing so here goes. We are working to create a set of Golang wrapper functions/methods that call into an existing database product (YottaDB) that has a C interface. This was going well until we ran i

Re: [go-nuts] gofmt does not recognize "type x = y"

2018-08-29 Thread Ian Lance Taylor
On Wed, Aug 29, 2018 at 11:41 AM, rajesh nataraja wrote: > > whereas go compiler recognizes it. Why are the tools not matching? This is > with go 1.9.7 > > > gofmt throws the following error > > expected type, found '=' Make sure you are using a gofmt built with Go 1.9, not some older version th

Re: [go-nuts] Golang function(s) returning EINTR due to 3rd party products being linked/used (revisited)

2018-08-29 Thread Ian Lance Taylor
On Wed, Aug 29, 2018 at 12:23 PM, wrote: > > Although I spent some time searching, I have not found an issue quite like > the one I’m experiencing so here goes. We are working to create a set of > Golang wrapper functions/methods that call into an existing database product > (YottaDB) that has a

Re: [go-nuts] gofmt does not recognize "type x = y"

2018-08-29 Thread rajesh nataraja
My bad! I sent it out too soon. You are right, my paths ended up being inconsistent between the two binaries. Rajesh. On Wednesday, August 29, 2018 at 1:09:32 PM UTC-7, Ian Lance Taylor wrote: > > On Wed, Aug 29, 2018 at 11:41 AM, rajesh nataraja > wrote: > > > > whereas go compiler recogni

Re: [go-nuts] Re: Regarding string immutablity

2018-08-29 Thread Dan Kortschak
Also see caveats discussed here https://groups.google.com/d/topic/golan g-nuts/sKQtvluD_So/discussion On Tue, 2018-08-28 at 17:00 +, 'Borman, Paul' via golang-nuts wrote: > You are only overwriting the pointer to the string (a string is > essentially a pointer and a length).  If you want to us

[go-nuts] go1.11 no longer supports compressed hostnames in SRV lookup replies

2018-08-29 Thread jason
We are using SRV records in Kubernetes for various purposes and Go 1.11 no longer supports compressed names in SRV resource data (https://github.com/golang/net/commit/24dd3780ca4f75fed9f321890729414a4b5d3f13#diff-47e2241916c7047eab73daf76c89fc3fR2055). The error we are getting is "cannot unmars

[go-nuts] Go2 Error Handling - Alternate Handler Concept

2018-08-29 Thread Liam
Re the Go2 Error Handling proposal https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling.md I have posted this feedback https://gist.github.com/networkimprov/c6cb3e2dff18d31840f2ef22e79d4a1e Which contains an alternate handler concept. Please let me know if you think

Re: [go-nuts] go1.11 no longer supports compressed hostnames in SRV lookup replies

2018-08-29 Thread Nathan Fisher
Can you share examples? On Wed, Aug 29, 2018 at 19:08, wrote: > We are using SRV records in Kubernetes for various purposes and Go 1.11 no > longer supports compressed names in SRV resource data ( > https://github.com/golang/net/commit/24dd3780ca4f75fed9f321890729414a4b5d3f13#diff-47e2241916c7047

Re: [go-nuts] go1.11 no longer supports compressed hostnames in SRV lookup replies

2018-08-29 Thread jason
This code works in our Kubernetes cluster when compiled with Go 1.10 and does not work when compiled with Go 1.11, we are using the built-in Go resolver. https://play.golang.org/p/JNSJEm1n6hg On Wednesday, August 29, 2018 at 4:28:54 PM UTC-6, Nathan Fisher wrote: > > Can you share examples? > O

[go-nuts] Compiler Bug: function argument hiding built-in function results in a compiler crash

2018-08-29 Thread taylorza
Hi, Before reporting this bug I thought I would post here to confirm that it has not been covered already. If a function argument hides a built-in function and there is an attempt to call the built-in function the compiler will crash with no indication of where it was in the compilation proces

[go-nuts] Character Replacement/Algorithm for Replacement

2018-08-29 Thread agruetz45
I have approximately 9 characters that all need to be replaced with different characters. I know there are a number of ways to do this but what is the most efficient? - 1) Do a []byte walk and compare each byte and replace when found? - Seems expensive if you have a 100 bytes in the []byt

[go-nuts] Re: Compiler Bug: function argument hiding built-in function results in a compiler crash

2018-08-29 Thread taylorza
Sorry, should have mentioned I came across this in *go1.11* but I have not validated that it is not an issue in earlier releases. On Wednesday, August 29, 2018 at 9:14:03 PM UTC-4, Chris Taylor wrote: > > Hi, > > Before reporting this bug I thought I would post here to confirm that it > has not

Re: [go-nuts] Re: Compiler Bug: function argument hiding built-in function results in a compiler crash

2018-08-29 Thread Ian Lance Taylor
On Wed, Aug 29, 2018 at 6:16 PM, wrote: > Sorry, should have mentioned I came across this in go1.11 but I have not > validated that it is not an issue in earlier releases. I can't find anything similar in the issue tracker. Please do file a bug report at https://golang.org/issue. Thanks. Ian

Re: [go-nuts] gofmt formats different than goimports in go1.11

2018-08-29 Thread Ian Lance Taylor
On Tue, Aug 28, 2018 at 11:58 PM, Rohit Jain wrote: >>Rebuild goimports with Go 1.11. > > Thanks, Ian, > I did go get -v -u golang.org/x/tools/cmd/goimports after removing > `goimports` from $GOPATH/bin, still the same behaviour Ah, OK, in that case make sure you are using the 1.11 version of gof

Re: [go-nuts] Re: Compiler Bug: function argument hiding built-in function results in a compiler crash

2018-08-29 Thread taylorza
Thanks Ian, I have filed the bug report : https://github.com/golang/go/issues/27356 On Wednesday, August 29, 2018 at 9:22:49 PM UTC-4, Ian Lance Taylor wrote: > > On Wed, Aug 29, 2018 at 6:16 PM, > > wrote: > > Sorry, should have mentioned I came across this in go1.11 but I have not > > valid

Re: [go-nuts] Re: os.WriteFile not writing files in long running process

2018-08-29 Thread Matt Harden
>From the program's perspective the file is indeed flushed on close. The kernel deferring writes to disk can only have any effect if the system crashes, and the files will be flushed to disk within a short time anyway. You absolutely do NOT need to call fsync every file on close unless you require

[go-nuts] Are Go floats smarter?

2018-08-29 Thread José Colón
I read that a common way to demonstrate that floating point numbers suffer from approximation problems is by calculating this: 0.3 - 0.1 * 3 which should produce 0 but in Java, Python, and Javascript for example, they produce -5.551115123125783e-17 . Surprisingly (or not, ;) ), Go produces th

Re: [go-nuts] Are Go floats smarter?

2018-08-29 Thread Dan Kortschak
The calculation you are doing there is likely using the compiler's constants which are at least 256 bits wide (https://golang.org/ref/spec #Constants) This displays the difference: https://play.golang.org/p/qNDzoh63LDk See also https://blog.golang.org/constants On Wed, 2018-08-29 at 19:33 -0700,

[go-nuts] Re: Are Go floats smarter?

2018-08-29 Thread Tristan Rice
I believe this is because that expression is handled as an untyped constant by the compiler. If you actually create proper variables with the values you get the same result as Java, Python, etc. https://play.golang.org/p/tIMpYT-bFzm On Wednesday, August 29, 2018 at 7:33:16 PM UTC-7, José Colón

Re: [go-nuts] Character Replacement/Algorithm for Replacement

2018-08-29 Thread Daniela Petruzalek
Do you have an example? I'm assuming that the replacement is one character for another. (ie.: not one character being replaced by a group of characters). Regarding to finding the positions to replace you can't beat O(n) complexity as you must look at least once at every character on the source st

[go-nuts]

2018-08-29 Thread John Shahid
-- 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] using go modules replace with old repos

2018-08-29 Thread John Shahid
Hi all, Is there a way to use the go module `replace' directive for packages that don't have go.mod yet ? I tried doing that and I get the following error: > go: parsing ../pkg/go.mod: open /path/to/pkg/go.mod: no such file or > directory According to https://github.com/golang/go/issues/24110 it

Re: [go-nuts] Character Replacement/Algorithm for Replacement

2018-08-29 Thread agruetz45
Makes sense. Best I am going to get is a linear search w/ a divide and conquer if I want to speed it up. Thanks needed the sounding board and feed back. Thanks, Anthony On Wednesday, August 29, 2018 at 8:16:44 PM UTC-7, Daniela Petruzalek wrote: > > Do you have an example? > > I'm assuming tha

Re: [go-nuts] Character Replacement/Algorithm for Replacement

2018-08-29 Thread Tamás Gulácsi
An even faster lookup is creating a [256]byte array for the replacements, having the 9 replacements candidates _position_ having the replacements, all others the identity: // prepare the lookup table var a [256]byte for i := 0; i<256; i++ { a[i] = i } a[37] = '-' a[129] = '-' ... // replace t