[go-nuts] Cross-compile macOS binary with cgo DNS resolver enabled

2018-08-30 Thread Julien Gricourt
I'm trying to cross-compile a macOS binary in Docker with the cgo DNS resolver enabled. My understanding is that this is doable without setting up a full macOS SDK toolchain, and by using the package from the macOS distribution. However, I'm unable to make it work. Somehow the compiler always r

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

2018-08-30 Thread jason
We have traced the issue to the Kubernetes DNS server, kube-dns. It is returning compressed hostnames in SRV query responses. It can be reproduced by running The following app exits with an error in MiniKube (or any other Kubernetes cluster with kube-dns). cannot unmarshal DNS message - Targ

Re: [go-nuts] How to make UDP server performance better?

2018-08-30 Thread Matt Harden
The time spent in the syscall would include time blocked, waiting for a packet to arrive. I would look at the other parts of the profile for possible improvements. The kernel may also be dropping packets if there is not enough buffer space to receive them into; see the SO_RCVBUF socket option. Mayb

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

2018-08-30 Thread Agniva De Sarker
We will shift over the features from godoc to "go doc" before removing support, so that the output remains consistent. I think there is already an open issue for exactly what you have shown above. So no worries, things will be the same. On Friday, 31 August 2018 02:16:54 UTC+5:30, John Shahid w

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

2018-08-30 Thread Agniva De Sarker
Hmm .. you can still generate html docs in a round-about fashion by spinning up the godoc server and storing the response of the http request of the package path. Otherwise, you are free to use the godoc2md tool - https://github.com/davecheney/godoc2md, which generates markdown pages from a pa

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Nigel Tao
On Fri, Aug 31, 2018 at 11:41 AM Eric Raymond wrote: > On Thursday, August 30, 2018 at 8:31:44 PM UTC-4, Ian Lance Taylor wrote: >> Which docs did you look at? Just wondering what could be updated. > > This: https://research.swtch.com/interfaces I'm only guessing, but I think Ian's "which docs

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Nigel Tao
On Fri, Aug 31, 2018 at 9:50 AM Eric Raymond wrote: > That was helpful. I feel like I have a more solid grasp now, though I'm a > bit worried about what details might have changed. IIRC, as of some years ago (Go 1.3 or 1.4??), the value inside an interface is now always a pointer, because some

[go-nuts] Some background on reposurgeon and my Go translation problem

2018-08-30 Thread Eric Raymond
There's been enough interest here in the technical questions I've been raising recently that a bit of a backgrounder seems in order. Back in 2010 I noticed that git's fast-import stream format opened up some possibilities its designers probably hadn't anticipated. Their original motivation was

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
On Thursday, August 30, 2018 at 8:31:44 PM UTC-4, Ian Lance Taylor wrote: > > > That was helpful. I feel like I have a more solid grasp now, though > I'm a > > bit worried about what details might have changed. Is there any chance > of > > getting the author to update this and add it to th

[go-nuts] Re: parse date/time with comma before millis

2018-08-30 Thread peterGo
Adam, In Go, it's usual to hide any ugliness in a function. For example, https://play.golang.org/p/cfj8NntLHAO Peter On Thursday, August 30, 2018 at 7:21:33 PM UTC-4, skirmish wrote: > > In example code here; https://play.golang.org/p/4P2nH_KE8uu > > I'm trying to parse a date time string of th

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Ian Lance Taylor
On Thu, Aug 30, 2018 at 4:50 PM, Eric Raymond wrote: > > On Thursday, August 30, 2018 at 7:25:10 PM UTC-4, Nigel Tao wrote: >> >> On Fri, Aug 31, 2018 at 4:18 AM Burak Serdar wrote: >> > If b is an interface to a *Blob, what's stored in the slice is {Type: >> > *Blob, Value: pointer to the object

[go-nuts] struct literals require keys on GAE?

2018-08-30 Thread Dan Kortschak
It is my recollection that GAE requires that struct literals have explicit keys. However, I cannot find any documentation of this. Is this requirement the case? Was it ever or did I imagine it? thanks Dan -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
On Thursday, August 30, 2018 at 7:25:10 PM UTC-4, Nigel Tao wrote: > > On Fri, Aug 31, 2018 at 4:18 AM Burak Serdar > wrote: > > If b is an interface to a *Blob, what's stored in the slice is {Type: > > *Blob, Value: pointer to the object}. A copy of this interface value > > is also in the ma

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Nigel Tao
On Fri, Aug 31, 2018 at 4:18 AM Burak Serdar wrote: > If b is an interface to a *Blob, what's stored in the slice is {Type: > *Blob, Value: pointer to the object}. A copy of this interface value > is also in the map. So you have two copies of the interface value, > both pointing to the same Blob o

Re: [go-nuts] reflect to get value type of a map

2018-08-30 Thread Dan Kortschak
The Type.Elem method gets you that. https://play.golang.org/p/ercS5yo3jm3 On Thu, 2018-08-30 at 18:06 -0500, Mark Volkmann wrote: > I see that I can use the `reflect` package to get the key type of a > map > like this: > > ```go > mt := reflect.TypeOf(myMap) > fmt.Println("key type is", mt.Key()

[go-nuts] parse date/time with comma before millis

2018-08-30 Thread skirmish
In example code here; https://play.golang.org/p/4P2nH_KE8uu I'm trying to parse a date time string of the form 2015-09-09 15:21:08,431 but using the format of 2006-01-02 15:04:05,999 (among many others that I've tried) which I'd expect to work, the time.Parse doesn't want to take the format. Lo

[go-nuts] reflect to get value type of a map

2018-08-30 Thread Mark Volkmann
I see that I can use the `reflect` package to get the key type of a map like this: ```go mt := reflect.TypeOf(myMap) fmt.Println("key type is", mt.Key()) ``` But I don't see a way to get the value type of a map. Is there a method to do this? -- R. Mark Volkmann Object Computing, Inc. -- You r

[go-nuts] Re: runtime: invalid pc-encoded table (invalid runtime symbol table)

2018-08-30 Thread Krzysztof Kowalczyk
The second issue is a bug in runtime, which might be fixed in 1.11 (https://github.com/golang/go/issues/24925 and https://github.com/golang/go/issues/25499 and https://github.com/golang/go/issues/24634 look like might be the issue). The original issue is that storage library calls Client.Do() o

Re: [go-nuts] runtime: invalid pc-encoded table (invalid runtime symbol table)

2018-08-30 Thread Ewan Walker
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) reader, err := object.NewReader(ctx) if err != nil { //handle } Likely then an issue with the cloud storage library when it needs to retry! That is what I had figured... I'm going to have to open an issue there. On Thursday

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

2018-08-30 Thread Paul Jolly
cc Ian Cottrell On Thu, 30 Aug 2018 at 14:08, Justin Israel wrote: > > > > On Thu, Aug 30, 2018, 9:54 PM Agniva De Sarker > wrote: >> >> I had filed https://github.com/golang/go/issues/26827 to list the changes >> that godoc needs to make. Please feel free to add your comments there. >> >> Also

Re: [go-nuts] runtime: invalid pc-encoded table (invalid runtime symbol table)

2018-08-30 Thread 'Borman, Paul' via golang-nuts
Looks like a nil context? vendor/cloud.google.com/go/storage.runWithRetry.func1(0x0, 0x0, 0xc450328a20) 100 err = runWithRetry(ctx, func() error { -Paul On Aug 30, 2018, at 1:05 PM, Ewan Walker mailto:e...@grandslammedia.com>> wrote:

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

2018-08-30 Thread Justin Israel
On Thu, Aug 30, 2018, 9:54 PM Agniva De Sarker wrote: > I had filed https://github.com/golang/go/issues/26827 to list the changes > that godoc needs to make. Please feel free to add your comments there. > > Also - note that godoc cli mode is going to go away. So "godoc -links=0 > -html domain.com

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
On Thursday, August 30, 2018 at 3:00:18 PM UTC-4, Burak Serdar wrote: > > If you're porting from another language, you're likely to encounter > this situation soon, if not already. > Right, and because Python code often makes aggressive use of runtime polymorphism it's *particularly *likely

[go-nuts] runtime: invalid pc-encoded table (invalid runtime symbol table)

2018-08-30 Thread Ewan Walker
I've been trying to trace a crash (seemingly from a dependency) for quite some time: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x656492] goroutine 86 [running]: net/http.(*Client).deadline(0x0, 0xc42e2dc

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
oops, gave link to a dup, here's a right one: https://github.com/golang/go/issues/27380 четверг, 30 августа 2018 г., 22:06:36 UTC+3 пользователь Denis Cheremisov написал: > > Filled a new issue: https://github.com/golang/go/issues/27381 > Please let me know if a title is too weird, I am about as

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
Filled a new issue: https://github.com/golang/go/issues/27381 Please let me know if a title is too weird, I am about as good with them as with variable names :) четверг, 30 августа 2018 г., 21:35:21 UTC+3 пользователь Sam Whited написал: > > FWIW, I have the same issue (I have to unset GO111MODUL

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Burak Serdar
On Thu, Aug 30, 2018 at 12:49 PM Eric Raymond wrote: > > > > On Thursday, August 30, 2018 at 2:18:38 PM UTC-4, Burak Serdar wrote: >> >> If b is an interface to a *Blob, what's stored in the slice is {Type: >> *Blob, Value: pointer to the object}. A copy of this interface value >> is also in the m

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
On Thursday, August 30, 2018 at 2:18:38 PM UTC-4, Burak Serdar wrote: > > If b is an interface to a *Blob, what's stored in the slice is {Type: > *Blob, Value: pointer to the object}. A copy of this interface value > is also in the map. So you have two copies of the interface value, > both poi

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Sam Whited
FWIW, I have the same issue (I have to unset GO111MODULE before attempting to fetch a binary or before building Go) and there appear to be several comments on the closed issue suggesting that this is still a problem: https://golang.org/issues/26639 I just tested this on tip (currently devel +36

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
strange, still the same $ go get -x -u golang.org/x/tools/cmd/goimports go: cannot find main module; see 'go help modules' I am using $ go version go version go1.11 linux/amd64 with export GO111MODULE=on четверг, 30 августа 2018 г., 18:21:45 UTC+3 пользователь Ian Davis написал: > > > On

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Burak Serdar
On Thu, Aug 30, 2018 at 12:09 PM Eric Raymond wrote: > > >> >> If Event is your interface and EventImpl is your struct, what you need >> is a map[string]Event, not map[string]*Event. Make sure you put >> &EvenImpl{} to your slices and maps, not EventImpl{} >> > > Here'a what is confusing me. Yes,

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
> > If Event is your interface and EventImpl is your struct, what you need > is a map[string]Event, not map[string]*Event. Make sure you put > &EvenImpl{} to your slices and maps, not EventImpl{} > > Here'a what is confusing me. Yes, I can write _mark_to_object map[string]Event and b.re

[go-nuts] Re: Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
On Thursday, August 30, 2018 at 1:32:18 PM UTC-4, Akram Ahmad wrote: > > Your work on porting *reposurgeon* (from Python into Go) for improved > performance sounds very cool, Eric (BTW, your work in, and musings on, Lisp > and UNIX have been a huge influence on my evolution as a programmer. Kud

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread 'Thomas Bushnell, BSG' via golang-nuts
Basically you almost never want pointer-to-interface in practice. The temptation is to have a struct which satisfies your interface, and then you end up with thinking you want pointer-to-interface. Instead, make pointer-to-struct satisfy the interface, and then you don't need pointer-to-interface

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Burak Serdar
On Thu, Aug 30, 2018 at 11:34 AM Eric Raymond wrote: > > > > On Thursday, August 30, 2018 at 1:14:25 PM UTC-4, Jan Mercl wrote: >> >> On Thu, Aug 30, 2018, 18:57 Eric Raymond wrote: >>> >>> I'm trying to translate this to Go in a type-safe way. To do this, I need >>> to be able to write two decl

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

2018-08-30 Thread Michael Jones
Always true. But hard to believe that a map could be faster. The array will be on the stack. On Thu, Aug 30, 2018 at 9:31 AM Marvin Renich wrote: > * Michael Jones [180830 11:44]: > > The task to "translate a string through a table" is common. It is a > single > > computer instruction (TR) in t

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
On Thursday, August 30, 2018 at 1:14:25 PM UTC-4, Jan Mercl wrote: > > On Thu, Aug 30, 2018, 18:57 Eric Raymond > > wrote: > >> I'm trying to translate this to Go in a type-safe way. To do this, I need >> to be able to write two declarations: "Slice of pointers to objects >> satisfying the Eve

[go-nuts] Re: Reference to type satisfying a specified interface

2018-08-30 Thread Akram Ahmad
Your work on porting *reposurgeon* (from Python into Go) for improved performance sounds very cool, Eric (BTW, your work in, and musings on, Lisp and UNIX have been a huge influence on my evolution as a programmer. Kudos for that! On Thursday, August 30, 2018 at 11:56:58 AM UTC-5, Eric Raymond

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Jan Mercl
On Thu, Aug 30, 2018, 18:57 Eric Raymond wrote: > I apologize if this seems like an elementary question, but web searches > and reading the Go documentation is not turning up an answer. > > I'm in the process of translating reposurgeon, an editor for > version-control histories, from Python into

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Burak Serdar
Did you try something like this? What errors did you get? type Event interface { ... } type EventImpl struct { ... } eventSlice:=make([]Event,0) eventMap:=make(map[string]Event) event:=&EventImpl{} eventSlice=append(eventSlice,event) eventMap["key"]=event On Thu, Aug 30, 2018 at 10:57 AM

[go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Eric Raymond
I apologize if this seems like an elementary question, but web searches and reading the Go documentation is not turning up an answer. I'm in the process of translating reposurgeon, an editor for version-control histories, from Python into Go for improved performance, .The central data structure

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

2018-08-30 Thread José Colón
>From what I've seen in the wild and searching for options on the Web, using big integers to store the lowest denomination of any given currency is very popular indeed, and I suspect ir should also perform better as a bonus. On Wednesday, August 29, 2018 at 10:33:16 PM UTC-4, José Colón wrote: >

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

2018-08-30 Thread Marvin Renich
* Michael Jones [180830 11:44]: > The task to "translate a string through a table" is common. It is a single > computer instruction (TR) in the IBM 360 and was extended over time with > related instructions for conversion in and out of UTF-8, testing before and > after translation, and expanded ch

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

2018-08-30 Thread Michael Jones
The task to "translate a string through a table" is common. It is a single computer instruction (TR) in the IBM 360 and was extended over time with related instructions for conversion in and out of UTF-8, testing before and after translation, and expanded character sizes. Tamás Gulácsi's approach w

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Ian Davis
On Thu, 30 Aug 2018, at 3:37 PM, Denis Cheremisov wrote: > Hi! > With Go 1.10 and earlier one can install binaries via regular `go > get`, `go get golang.org/x/tools/cmd/goimports` for instance.> It doesn't > work with Go modules enabled: > > $ go get golang.org/x/tools/cmd/goimports > go: canno

Re: [go-nuts] Calling HTML DOM functions with wasm

2018-08-30 Thread Jannis Andrija Schnitzer
https://gist.github.com/Xjs/d6b879915716dddff486301a169b4c21 works for me. What was the exact problem you were having? J. -- 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

[go-nuts] Coming to Go (from Java / Scala / Clojure).

2018-08-30 Thread Akram Ahmad
I must confess that Go has taken me by surprise: It's is refreshingly lightweight language that's steadily growing on. Has anyone (around here) shared their journey to Go land? FWIW, here's a rundown of my journey: *Further Adventures In Go Land

[go-nuts] Urgent Freelancer Position at Verisart in London

2018-08-30 Thread Robert Norton
*We’re looking for a Senior **Golang and RESTful API developer* to support our in-house development team and who could start immediately. Knowledge of micro services also helpful. The main issue we’re facing is that we’re currently upgrading our technical stack and moving from a tightly coupled

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

2018-08-30 Thread Manlio Perillo
On Friday, August 24, 2018 at 11:20:46 AM UTC+2, Paweł Szczur wrote: > > Hi, > > I have a long running hobby program with a code: > > var ( >url = "https://example.com"; >lastBody []byte > ) > > > func get(client *http.Client, dir) (changed bool, data []byte, err error) { > >resp,

[go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
Hi! With Go 1.10 and earlier one can install binaries via regular `go get`, `go get golang.org/x/tools/cmd/goimports` for instance. It doesn't work with Go modules enabled: $ go get golang.org/x/tools/cmd/goimports go: cannot find main module; see 'go help modules' this is an obvious usability d

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

2018-08-30 Thread 'Borman, Paul' via golang-nuts
For financial programs you may want to consider fixed point decimal values rather than floats. In simple terms, rather than using floating point units of currency, you use integers for the smallest acceptable quantity. This might be, for example, using an int to say how many pennies are involv

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

2018-08-30 Thread Marvin Renich
* José Colón [180830 06:53]: > Very interesting. So would it be a good idea to use these types of untyped > constant calculations for financial applications, or instances where one > would use the math.big package? Not likely. You would have to know at compile time the exact values you wanted

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

2018-08-30 Thread Marvin Renich
* Tamás Gulácsi [180830 01:17]: > 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]

[go-nuts] Re: Cross compiling sers (with CGO) to Android

2018-08-30 Thread distributed
This is embarassing, but setting GOOS=android fixed the issue. I was under the impression that android builds were only supported with an addition to the toolchain. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

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

2018-08-30 Thread José Colón
Very interesting. So would it be a good idea to use these types of untyped constant calculations for financial applications, or instances where one would use the math.big package? On Wednesday, August 29, 2018 at 10:33:16 PM UTC-4, José Colón wrote: > > I read that a common way to demonstrate th

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

2018-08-30 Thread Agniva De Sarker
I had filed https://github.com/golang/go/issues/26827 to list the changes that godoc needs to make. Please feel free to add your comments there. Also - note that godoc cli mode is going to go away. So "godoc -links=0 -html domain.com/group/project/v3/lib/foo" is not going to work after 1.12. Yo