[go-nuts] contexts for busy computations

2017-04-11 Thread Alex Flint
Suppose I have a long-running computation that I wish to be cancelable via a context. By this I mean something that's just churning away on some computation, not blocking on a syscall or I/O operation or anything like that. Should I just poll ctx.Err() periodically in the inner loop of my computati

Re: [go-nuts] Re: efficiency of string <-> []byte conversion

2017-02-13 Thread Alex Flint
/groups.google.com/forum/#!searchin/golang-nuts/byte$20slice$20string$20copy|sort:relevance/golang-nuts/fXmG83gZOJg/eixtKSQiNysJ > > > On Monday, February 13, 2017 at 9:31:06 PM UTC+1, Alex Flint wrote: > > As of go1.8, do conversions between strings and byte slices always > generate a copy?

[go-nuts] efficiency of string <-> []byte conversion

2017-02-13 Thread Alex Flint
As of go1.8, do conversions between strings and byte slices always generate a copy? I understand the immutability guarantees in the language spec, but I'm interested in this from an efficiency standpoint. I can imagine a compiler that analyzes whether a byte slice created from such a conversion

[go-nuts] extracting transport failures in httputil.ReverseProxy

2016-12-20 Thread Alex Flint
Recently while using http.ReverseProxy I wanted to take a specific action if there was a TCP connection failure or other transport-level failure in ReverseProxy.ServerHTTP. However, ReverseProxy.ServeHTTP simply sets a BadGateway status code in this situation, which makes it impossible to different

Re: [go-nuts] package containing standard CA roots?

2016-12-17 Thread Alex Flint
I'm working with busybox, which does not ship with CA roots. On Sat, Dec 17, 2016 at 12:26 AM Konstantin Khomoutov < flatw...@users.sourceforge.net> wrote: > On Thu, 15 Dec 2016 16:35:09 +0000 > Alex Flint wrote: > > > Does anyone know of a golang package that embeds

[go-nuts] package containing standard CA roots?

2016-12-15 Thread Alex Flint
Does anyone know of a golang package that embeds (go-bindata or similar) a reasonable standard set of CA roots? Ideally such a package would provide a ready-to-use http.Client. For context, I'm building minimal docker images containing go binaries that need to make https connections to some third

Re: [go-nuts] interpreting in a traceback

2016-09-19 Thread Alex Flint
wrote: > On Mon, Sep 19, 2016 at 3:21 PM, Alex Flint wrote: > > I am looking for help understanding the following lines in a Go > traceback: > > > > 6 File "specialized.go" line 163 in pythontype.ExplicitFunc.Call > > 7 File "" line 510 in pythont

[go-nuts] interpreting in a traceback

2016-09-19 Thread Alex Flint
I am looking for help understanding the following lines in a Go traceback: 6 File "specialized.go" line 163 in pythontype.ExplicitFunc.Call 7 File "" line 510 in pythontype.(*ExplicitFunc).Call 8 File "propagate.go" line 622 in pythonstatic.(*propagator).evaluateCallExpr I am trying to understand

[go-nuts] make a struct pointer _not_ implement an interface

2016-09-12 Thread Alex Flint
Is it possible to have a struct that implements an interface, but have pointers to the struct not implement the interface? The reason is that I want to find all the places in our codebase that attempt to use a pointer to a certain struct as a certain interface. -- You received this message becaus

[go-nuts] cgo and OSX "main thread"

2016-09-09 Thread Alex Flint
I am using cgo to wrap a library that creates an OSX UI, which requires things to be run on the "main thread". Sometimes my cgo calls end up on the main thread and sometimes they do not (I check this with [NSThread isMainThread]). I understand that cgo threads are guaranteed to run on an OS-allocat

Re: [go-nuts] compressing long list of short strings

2016-08-10 Thread Alex Flint
the underlying compressor state. Or perhaps I'm looking in the wrong package - any pointers would be appreciated. On Wed, Aug 10, 2016 at 3:42 PM Ian Lance Taylor wrote: > On Wed, Aug 10, 2016 at 3:27 PM, Alex Flint wrote: > > > > I have long list of short strings that I w

[go-nuts] compressing long list of short strings

2016-08-10 Thread Alex Flint
I have long list of short strings that I want to compress, but I want to be able to decompress an arbitrary string in the list at any time without decompressing the entire list. I know the list ahead of time and it doesn't matter how much preprocessing time is involved. It is also fine if there is

[go-nuts] gob-encoding pointer to zero

2016-08-05 Thread Alex Flint
Is it intended that gob-encoding a pointer to an integer with value equal to zero decodes as a nil pointer? I was expecting to get back a non-nil pointer to an integer with value zero. https://play.golang.org/p/UUN0UFEeIN I understand that gob omits zero values but my understanding was that a non

[go-nuts] getting the receiver from a bound method

2016-07-21 Thread Alex Flint
Is it possible to use reflection to retrieve the value of x from reflect.ValueOf(x.SomeMethod) where x is an instance of some struct type? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fr

Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-29 Thread Alex Flint
Sorry to keep bothering you folks with this but does anybody have an answer to this? On Tue, Jun 21, 2016 at 9:26 AM Alex Flint wrote: > Oh I expected that since I only called encoder.Encode once, there would > only be on repetition of the outermost segment. I was expecting the > wireT

Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-21 Thread Alex Flint
t; -rob > > > On Tue, Jun 21, 2016 at 8:20 AM, Alex Flint wrote: > >> The gob docs state that a gob stream consists of >> >> (byteCount (-type id, encoding of a wireType)* (type id, encoding of >> a value))* >> >> I was expecting byteCount to be

[go-nuts] semantics of byteCount in gob encoding

2016-06-21 Thread Alex Flint
The gob docs state that a gob stream consists of (byteCount (-type id, encoding of a wireType)* (type id, encoding of a value))* I was expecting byteCount to be the number of bytes remaining in the entire packet, but that does not seem to be the case. For example when encoding a single instan

Re: [go-nuts] caching of cgo compilation

2016-06-15 Thread Alex Flint
code. Whenever I make changes to Go sources in mypkg I can see that the cgo compiler is being run on go-sqlite3. On Wed, Jun 15, 2016 at 3:23 PM Ian Lance Taylor wrote: > On Wed, Jun 15, 2016 at 2:54 PM, Alex Flint wrote: > > Under what conditions does a cgo package get recompiled? I a

[go-nuts] caching of cgo compilation

2016-06-15 Thread Alex Flint
Under what conditions does a cgo package get recompiled? I am using go-sqlite3 and it appears that the C compiler/linker is run every time I build my project, even though I am not changing any of the C sources. I would have expected it to be run once and then the results re-used, but perhaps there