[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

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

2017-02-13 Thread Alex Flint
roups.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 c

[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

[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

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 <alex.fl...@gmail.com> wrote: > > > Does anyone know of a gol

[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
t;i...@golang.org> wrote: > On Mon, Sep 19, 2016 at 3:21 PM, Alex Flint <alex.fl...@gmail.com> wrote: > > I am looking for help understanding the following lines in a Go > traceback: > > > > 6 File "specialized.go" line 163 in pythontype.ExplicitFunc.Call >

[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

[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

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

2016-08-10 Thread Alex Flint
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 <i...@golang.org> wrote: > On Wed, Aug 10, 2016 at 3:27 PM, Alex Flint <alex.fl...@gmail.com> wrote: > > > > I have long l

[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

[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

[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

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

2016-06-21 Thread Alex Flint
r. > -rob > > > On Tue, Jun 21, 2016 at 8:20 AM, Alex Flint <alex.fl...@gmail.com> wrote: > >> The gob docs state that a gob stream consists of >> >> (byteCount (-type id, encoding of a wireType)* (type id, encoding of >> a value))* >> >>

[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