[go-nuts] array indexed by derived type?

2018-10-06 Thread Steven Roth
Is there a way to declare an array (or slice) that is indexed by a type derived from int, rather than indexed by int? My intent is to have the compiler complain if I index the array/slice with a generic int rather than the specific int-derived type I'm supposed to use. This will help verify

[go-nuts] cross-compile mac to linux

2018-05-06 Thread Steven Roth
Can anyone point me to a recipe or guidance on how to set up a cross-compilation environment on a Mac that will allow me to build CGO-enabled Go code to run on Ubuntu? The program I'm building is pure Go except for an unavoidable dependency on libsqlite3. Thanks in advance, Steve -- You

[go-nuts] (*net.TCPListener).File() switches to blocking mode

2018-04-18 Thread Steven Roth
I just wrote some code for graceful restart of a web server, following models available on the web. Unlike those models, my code didn't work. The parent (old) web server refused to exit. The call to server.Shutdown returned success, and the listener got closed, but the server.Serve call never

[go-nuts] how to interpret debug/pprof/heap

2017-06-05 Thread Steven Roth
Hi, folks, I'm trying to track down a memory leak in a web server application, and I'm having a hard time making sense of the output of the heap dumps emitted by the net/http/pprof handlers. One of the dumps starts with: heap profile: 5: 192080 [47408: 90679856] @ heap/1048576 1: 155648 [1:

[go-nuts] storing transaction in context

2017-02-06 Thread Steven Roth
I'd like input on whether the following idea is good or bad, and why. Consider an abstract transaction, modeled as follows: func Transaction(ctx context.Context, body func(ctx context.Context) error) error func OnCommit(ctx context.Context, commitHook func(ctx context.Context)) func

Re: [go-nuts] validating self-signed certs

2016-12-08 Thread Steven Roth
Well, because when someone wants to import a new device, I can't change the existing Transport. The docs explicitly say not to change it once it's in use. Steve On Thu, Dec 8, 2016 at 8:42 AM, Andy Balholm wrote: > Why not make a tls.Config that trusts all the