Re: [go-nuts] net/http/httputil.ReverseProxy Expect: 100-continue broken?

2018-11-22 Thread Peter Waller
I suspect this has to do with the fact that you're doing a roundtrip for its side effects, but not reading the response body or closing it. If I fix that, everything seems to work as expected. Try configuring the TLS client with t.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} On Mon, 19

Re: [go-nuts] Does client.go#transport() reuse s global DefaultTransport when http.Client's Transport is nil?

2018-10-18 Thread Peter Waller
On Wed, 17 Oct 2018 at 17:30, Kyle Butz wrote: > It looks like transport() is returning a RoundTripper by value. Does that > mean that "return DefaultTransport" returns a new copy of DefaultTransport, > or just a copy of a pointer to the global DefaultTransport defined in > transport.go? > You m

Re: [go-nuts] Announcing pytogo. a crude but surprisingly effective Python to Go translator

2018-10-04 Thread Peter Waller
Hi Eric, I played around with some similar ideas a while back - I just blew the dust off it and published it here: https://github.com/pwaller/pp2g My approach is a bit different, and works by printing the Python AST in Go. There is an overlap in our philosophy of 'produce standalone code' and 'he

Re: [go-nuts] bufio.Writer's sticky errors & lost data

2018-09-20 Thread Peter Waller
On Thu, 20 Sep 2018 at 03:39, John Floren wrote: > What's the right way to handle this? Write our own bufio that lets us > reset the error and io.Writer while preserving unwritten data? > I'm not sure there is "one right way", but one possibility is to push the reliability layer one level down:

Re: [go-nuts] Ternary ... again

2018-08-16 Thread Peter Waller
On Wed, 15 Aug 2018 at 12:44, peterGo wrote: > Remember the Vasa! http://www.stroustrup.com/P0977-remember-the-vasa.pdf > That note from Stroustroup is profound. Thanks for sharing. Personally, I'm glad that we have a language where the philosophy is "What is the minimum feature-set which allows

Re: [go-nuts] Can go-dockerclient be built with go modules?

2018-08-16 Thread Peter Waller
Another issue worth consulting, https://github.com/golang/go/issues/26208, which isn't yet marked as resolved. -- 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 gol

Re: [go-nuts] Can go-dockerclient be built with go modules?

2018-08-14 Thread Peter Waller
There are a couple of issues it is useful to be aware of importing when depending on docker as a module. 1. docker's development is fragmented over various repositories, and docker/docker isn't tagged. docker/docker (an alias for moby/moby) still receives code updates imported from the other repos

Re: [go-nuts] Re: Go 1.11 Beta 3 is released

2018-08-09 Thread Peter Waller
Hi Ken, If "go get" succeeded, then probably this put something in $GOPATH/bin/go1.11beta3, but bash being unable to find it means that $GOPATH/bin is not in your $PATH environment variable; so bash can't find it. Try "$GOPATH/bin/go1.11beta3 download" or try adding $GOPATH/bin to your $PATH, then

Re: [go-nuts] golang tcp transport just like nc

2018-03-08 Thread Peter Waller
Once you've read all of os.Stdin, and the io.Copy finishes, you need to call conn.CloseWrite(), to signal to the other side that it won't receive any more bytes. Otherwise each side is blocked in io.Copy(os.Stdout, conn) waiting for more bytes to arrive from the other side. -- You received this m

Re: [go-nuts] memory leak, heap size doesn't match process res size

2018-02-15 Thread Peter Waller
On 14 February 2018 at 16:15, Kane Kim wrote: > If we don't use CGO all memory should be reported somewhere? > Well, assuming no part of your software calls mmap, or there isn't something else funny going on. Can you capture when this large region is mapped with strace? At what point in the pro

Re: [go-nuts] memory leak, heap size doesn't match process res size

2018-02-14 Thread Peter Waller
First, a sanity check: How are you measuring the resident set? Are you certain the memstats data you presented are from the same run (and after) you hit 10G resident? What you have described doesn't immediately fit in my mental model. Could you be measuring the VM size rather than the resident siz

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2018-02-07 Thread Peter Waller
On 6 February 2018 at 21:25, wrote: > What do you mean by a "slice pointer key" ? > > > map[*[]Something]string > > Then map consumers can do key comparisons. I originally used this for an > unordered set type. > I'm sure you are aware of the distinction but it might not be clear for others rea

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2018-02-06 Thread Peter Waller
On 6 February 2018 at 09:34, roger peppe wrote: > ... tick, tick, tick, tick... dide-dudi-diddlidedum...di > http://www.reactiongifs.com/wp-content/uploads/2011/09/mind_blown.gif -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe f

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2018-02-05 Thread Peter Waller
On 5 February 2018 at 11:04, roger peppe wrote: > > I'll bite, does it involve struct { len int; content [maxCount]int }, or > did > > you have something else in mind? > > Something else. No size limit. Not what one might call efficient though. :) > [low growling] (ok, so I've been watching Str

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2018-02-05 Thread Peter Waller
On 31 January 2018 at 16:23, roger peppe wrote: > BTW you can already do something like this: > https://play.golang.org/p/q4bz8-AckN3 Neat trick! > You can even do it without reflect, which I'll leave as an exercise for > the reader :) I'll bite, does it involve struct { len int; content [m

Re: [go-nuts] [ANN] reverse proxy with ssl in less than 100 lines of code

2018-01-03 Thread Peter Waller
On 28 December 2017 at 16:54, jzs wrote: > > Any feedback is more than welcome > Looks nice. A few minor ideas: There is code which appears after log.Fatal() - that code won't run because log.Fatal calls exit. Therefore the the waitgroup could be dropped and you'd have something shorter and stil

Re: [go-nuts] corrupt stack?

2017-12-04 Thread Peter Waller
Some worthwhile reading: https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong Races are important, and if your program has a race, otherwise impossible-seeming things can happen. First ruling out races is a worthwhile activity. In terms of debugging it,

Re: [go-nuts] Re: Tool to move identifier into new package?

2017-09-27 Thread Peter Waller
+cc Alan. Ping, I'm interested in this too. I've been looking around for tools to move declarations around but didn't find any. This would be very useful. Anyone aware of anything which has been published in a form which is easy to reuse (rather than a abandoned CL?) I saw godoctor at http://gor

Re: [go-nuts] Re: Bytconv where art thou

2017-09-26 Thread Peter Waller
On 25 September 2017 at 17:43, Amnon Baron Cohen wrote: > https://github.com/golang/go/issues/2632 > Nice link, fun to see that all this discussion has happened before (and no doubt, will happen again!). Reading that thread and related threads, I get the impression that there is not an open iss

Re: [go-nuts] Re: Bytconv where art thou

2017-09-24 Thread Peter Waller
On 15 September 2017 at 11:54, roger peppe wrote: > I suspect that this kind of performance issue may be fixed by better > compiler optimisation in the future (I think should be possible for > the compiler to notice that the string doesn't escape and pass a > pointer to the byte slice as the stri

Re: [go-nuts] Re: Bytconv where art thou

2017-09-15 Thread Peter Waller
Because of the immutability of the string, constructing a string on a byte slice requires allocating and copying the bytes. Once you've got the string, it's "free" to pass around. If you've already got strings, everything is fine. But if you're reading the data from IO, you're probably starting wi

Re: [go-nuts] Re: What are test binaries?

2017-09-05 Thread Peter Waller
On 5 September 2017 at 06:35, Volker Dobler wrote: > A "test binary" is a normal binary compiled by go test including the test > function > from the *_test.go files which executes the tests when run.. > It's worth nothing that this binary is ordinarily hidden if you just run `go test`. ... and

Re: [go-nuts] Bytconv where art thou

2017-09-01 Thread Peter Waller
On 1 September 2017 at 08:49, Sebastien Binet wrote: > > I'd also be very interested in looking at 'bytconv'. And most probably > should use it in anger :) > I've written my own bytconv.Atoi in two projects where it gave a nice speedup, so +1 to this. -- You received this message because you ar

Re: [go-nuts] Upload File Size Limit in Go 1.9

2017-08-31 Thread Peter Waller
I think this question is a protocol problem more than anything. A quick bit of searching "http server abort upload" reveals what to do: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.14 https://groups.google.com/forum/#!topic/golang-nuts/agB-n6V7UsQ There is also this informativ

Re: [go-nuts] A question about race conditions

2017-06-30 Thread Peter Waller
Can you provide example code which demonstrates the problem? What you are describing is not expected. Reading and writing to channels simultaneously with the `<-` operator from multiple goroutines should not generate memory race conditions by themselves, but concurrency is complicated and it is st

Re: [go-nuts] exec.CommandContext wrong behavior

2017-05-16 Thread Peter Waller
On 16 May 2017 at 12:56, wrote: > > [... kill does not kill all the processes ...] Is this normal behavior? It > seems strange. > One moment of enlightenment for me was to discover why CTRL-C at the terminal kills all of the processes, while kill(pid, SIG{whatever}) to the parent process does not

[go-nuts] [ANN] "Cartographer" points you at loops over maps - go forth and fix non-determinism bugs!

2017-04-04 Thread Peter Waller
Cartographer is a simple tool, it just prints out source locations of the specified packages which loop over maps. So you can audit them, and find some non-determinism bugs. https://github.com/pwaller/cartographer For anyone interested about how you might do this, the whole program is less than 6

Re: [go-nuts] Hidden vendoring trap

2017-02-07 Thread Peter Waller
This problem has come up on the list before [1]. The only way out I found was to remove the offending vendor directory from the project being vendored (or find a way that doesn't involve vendoring the equivalent of camlistore). On 6 February 2017 at 19:30, Tamás Gulácsi wrote: > Shall we reorgan

Re: [go-nuts] Foregrounding, process management, os/exec.Cmd

2017-01-23 Thread Peter Waller
I'm afraid I can't find the code, but I actually did this in the distant past and recall having some success. (I was the one who introduced Ctty to SysProcAttr for this very purpose! :). One thing it seems as though you're missing is you don't set SysProcAttr.Setctty. The documentation string for

Re: [go-nuts] Re: Help translate x86-64 assenbly to Go assembly

2017-01-17 Thread Peter Waller
A useful tool for this in general is https://github.com/Maratyszcza/PeachPy/ It will even generate BYTE directives if the go assembler doesn't support the instruction you want to use. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscrib

Re: [go-nuts] Re: [llgo-dev] Re: New home for GoLLVM

2016-12-31 Thread Peter Waller
December 2016 at 18:21, Will Norris wrote: > % curl http://llvm.org/llvm/bindings/go/llvm/?go-get=1 > >"http://www.w3.org/TR/html4/strict.dtd";> > > > > https://llvm.org/svn/llvm-project/llvm/trunk";> > > > Re

Re: [go-nuts] Re: [llgo-dev] Re: New home for GoLLVM

2016-12-27 Thread Peter Waller
godoc.org shows the documentation, but go get currently gives a 404 if I follow the instructions. Has it moved again? [404] https://llvm.org/llvm/bindings/go/llvm [works] https://godoc.org/llvm.org/llvm/bindings/go/llvm On 21 March 2015 at 08:28, Andrew Wilkins wrote: > > On Sat, 21 Mar 2015 at

Re: [go-nuts] Re: How can I make io.Reader stop reading?

2016-11-17 Thread Peter Waller
As far as I understand, that seems unlikely to solve the problem of the Read() function being blocked, if that is what is happening here. On 17 November 2016 at 10:34, Hoots The Owl wrote: > As far as I understood, Daniel means something like that > https://gowalker.org/github.com/northbright/ct

Re: [go-nuts] Re: How can I make io.Reader stop reading?

2016-11-17 Thread Peter Waller
Your original email was ambiguous and said "when a connection is closed", so I gave an answer for when `connTwo` is closed. But your actual question was "when `connOne`" is closed, if I'm understanding correctly given the program you posted. So given the program above, if `dst` is closed you should

Re: [go-nuts] httputil.ReverseProxy adding 100+ ms of latency on localhost - any ideas?

2016-11-17 Thread Peter Waller
Aha, sounds like the problem I was hitting, described in detail here: https://groups.google.com/d/topic/golang-nuts/UXOVPX4a6uA/discussion I didn't get any responses though so I was thinking it was a peculiarity of my setup and didn't bother to file a bug. If you run your server with GODEBUG=net

Re: [go-nuts] How can I make io.Reader stop reading?

2016-11-16 Thread Peter Waller
If connTwo is closed, Read will return io.EOF, and io.Copy will return. (With no error, because copy runs until io.EOF is reached). If that's not happening for you, can you give an example to reproduce? On 16 November 2016 at 14:49, Alexander Menzhinsky wrote: > When implementing a proxy server

[go-nuts] LookupHost taking up to 5 seconds to resolve localhost

2016-10-27 Thread Peter Waller
Hi Nuts, net.LookupHost is taking a long time (up to 5 seconds) to resolve localhost, where I expect it to be instant. At other times it can take anywhere from 1-100ms, but it seems to reliably return a result shortly after 5 seconds. The details: * I'm doing local development inside a docker co

Re: [go-nuts] Why can't you take the address of a function's return value?

2016-08-22 Thread Peter Waller
On 22 August 2016 at 19:09, Jan Mercl <0xj...@gmail.com> wrote: > > Strictly speaking you can take the address of function's return value (eg. > https://play.golang.org/p/0PTrkWEirW). It's like taking the address of > any variable. But that's an lvalue, which &f() is not. > You just exploded my h

Re: [go-nuts] How to get struct of function

2016-07-29 Thread Peter Waller
Try this: https://play.golang.org/p/zJa8N24nxi -- package main import ( "fmt" "log" "reflect" ) func main() { var controller interface{} = Test.IsWorking funcTyp := reflect.TypeOf(controller) structTyp := funcTyp.In(0) newValue := reflect.New(structTyp).Interface() fmt.Printf("%#+v", newValue)

Re: [go-nuts] serializing a value using Go syntax

2016-07-21 Thread Peter Waller
The closest thing I'm aware of is . Not sure if it solves your use case, but might get you some of the way there. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emai

Re: [go-nuts] Linux File descriptor question in golang

2016-07-21 Thread Peter Waller
On 21 July 2016 at 12:37, Alex Bligh wrote: > > On Linux (and indeed most if not all POSIX like systems) > one cannot get a file path from the file descriptor number. > This is irrespective of programming language used. While your statement is true generally, it is actually possible so long as t

Re: [go-nuts] Understanding HTTP server latencies

2016-07-18 Thread Peter Waller
If you run it on the same server as the host, does it perform differently there? For example, did you rule out network saturation effects? Do you have any HTTP middleware or proxies in the way? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To u

Re: [go-nuts] Understanding HTTP server latencies

2016-07-18 Thread Peter Waller
It really depends on what you're doing while handling your requests. It may or may not be reasonable. Are you touching external resources such as a database? Can you provide a minimal example to reproduce? It would also be useful if you supplied the exact commands you are running. I have managed

Re: [go-nuts] Segmentaion fault / static binary

2016-07-18 Thread Peter Waller
Sorry, I don't have any further suggestions. The only other things that spring to mind: * I tested on Ubuntu 15.10, with all of my packages uptodate. The distro could matter, in principle. * Is everything uptodate? Do you have the latest version of github.com/xeodou/go-sqlcipher and its dependenci

Re: [go-nuts] looking for the equivelant golang code in the aws s3 sdk, but have not found it yet. Anyone help here??? Thanks.

2016-07-18 Thread Peter Waller
Here's an example. It uses the machine's role credentials automatically. If you want to specify a secret manually, you'll have to read the documentation. https://github.com/aws/aws-sdk-go/ http://aws.amazon.com/sdk-for-go/ I can't guarantee it's uptodate, but something similar to this should work

Re: [go-nuts] Segmentaion fault / static binary

2016-07-18 Thread Peter Waller
I just tested this here on amd64 with go1.7rc1, and it works fine with no crash, so I don't know why it is crashing for you. What version of go are you using? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and sto

Re: [go-nuts] why treat int and []int differently here?

2016-07-16 Thread Peter Waller
I had written a response, but was beaten to the punch by Steven and Alex by seconds. I'll just add to what they've said. A surprising fact is that `int` is actually not an unnamed type, it's a pre-declared identifier: https://golang.org/ref/spec#Predeclared_identifiers Here's the (seemingly taut

[go-nuts] [ANN] goimports-update-ignore makes goimports faster, maintains .goimportsignore

2016-07-16 Thread Peter Waller
With , goimports now supports a mechanism for ignoring non-go-code directories. For cluttered source directories, this makes goimports quite a lot faster. The problem is, if you want to get the most benefit of this you may need to make and maintain a big

Re: [go-nuts] goimports has been updated

2016-07-15 Thread Peter Waller
On 15 July 2016 at 22:30, Dave Cheney wrote: > Why not put non go code in another directory tree? That seems much simpler. I agree with you and see where you're coming from. That was where my original hesitation came from, but... My $GOPATH is .local/src. Why set it anywhere else? Then, why re

Re: [go-nuts] goimports has been updated

2016-07-15 Thread Peter Waller
ng of guilt that it's probably your > fault and you should fix it, and other people use this thing nowadays. :) > > > > > On Fri, Jul 15, 2016 at 12:56 PM, Peter Waller > wrote: > >> Just saw this was merged - this is excellent. >> >> These latest changes b

Re: [go-nuts] goimports has been updated

2016-07-15 Thread Peter Waller
Just saw this was merged - this is excellent. These latest changes bring the runtime down to 400ms. Wonderful! I had no idea how much this was interrupting my flow before it was fixed :) On 15 July 2016 at 19:34, Brad Fitzpatrick wrote: > > Done: https://go-review.googlesource.com/24971 > --

Re: [go-nuts] goimports has been updated

2016-07-15 Thread Peter Waller
On 15 July 2016 at 16:35, Sam Whited wrote: > On Fri, Jul 15, 2016 at 9:49 AM, Peter Waller wrote: > > Another suggestion which might be even nicer for the implementation: if a > > directory contains `.goimportsignore`, that directory is skipped. > > That would have to be

Re: [go-nuts] goimports has been updated

2016-07-15 Thread Peter Waller
On 15 July 2016 at 15:31, Jan Mercl <0xj...@gmail.com> wrote: > I do not use goimports. My 2c anyway: What about checking for > .goimportsignore in the root of the subtree that should be skipped? > +1. I was going to suggest this but before seeing support for the idea thought it sounded too unsav

Re: [go-nuts] goimports has been updated

2016-07-15 Thread Peter Waller
Awesome! For me it brings the CPU time from 6.5s to 3s. Wall from 2.9s to 2s. A noticable improvement. One thing that still makes it slow for me (2s instead of 500ms, I just tested), is that I have several of deep trees which aren't go code in my $GOPATH/src. To name a few: linux, clang, llvm. I

Re: [go-nuts] Failure to go build -race with alpine and musl libc (__libc_malloc undefined)

2016-07-11 Thread Peter Waller
On 11 July 2016 at 15:30, Ian Lance Taylor wrote: > > If you just want to focus on Go, don't build the race detector. It > looks like you are running the command `go install -v -race .`. Don't > do that. This tickles me :). The whole point of course was that I want the race detector. Sadly my

Re: [go-nuts] Failure to go build -race with alpine and musl libc (__libc_malloc undefined)

2016-07-11 Thread Peter Waller
lback>, __sanitizer::NoOpMapUnmapCallback> >*)': gotsan.cc:(.text+0x5eb8): undefined reference to `__libc_free' collect2: error: ld returned 1 exit status On 11 July 2016 at 14:34, Ian Lance Taylor wrote: > On Mon, Jul 11, 2016 at 6:04 AM, Peter Waller wrote: > > > >

[go-nuts] Failure to go build -race with alpine and musl libc (__libc_malloc undefined)

2016-07-11 Thread Peter Waller
Hi All, I'm guessing the answer to this one is "use glibc", but I can't find any existing commentary on this in within the go ecosystem and thought it was worth a quick shot in case there is a fix. I'm aware that tsan and glibc are fairly well intermingled, so probably requires a lot of work possi

Re: [go-nuts] go1.6 buildmode=shared error on linux/amd64

2016-07-06 Thread Peter Waller
Hi Serhat, I just encountered this too, while trying to get started. The solution in my case was to actually use Cgo in my go program. Simply adding `import "C"` fixed the problem. Hope that helps! - Peter On 3 March 2016 at 21:40, Serhat Şevki Dinçer wrote: > Hi, > When I do *go build -buil

Re: [go-nuts] Extracting table data out of PDFs

2016-06-30 Thread Peter Waller
Hi Sankar, It may not be exactly what you're looking for but I can't resist the opportunity to plug our product! PDFTables.com has a remote API, you can see an example of how to use it here: https://github.com/pdftables/api/blob/master/go/cmd/pdftables-api/main.go You can get an API key and find

Re: [go-nuts] Re: upx / darwin support

2016-06-23 Thread Peter Waller
On 23 June 2016 at 04:49, Miki Tebeka wrote: > Which version of Go are you using? According to > https://github.com/pwaller/goupx upx should work well with go 1.6 > (didn't check) > goupx only ever worked with Linux binaries, not OSX (darwin) binaries. I (author of goupx) don't know the state of