#go-nuts

/

      • [o__o] joined the channel
      • bmats_ has quit
      • kazupon has quit
      • Gouou joined the channel
      • Gouou
        hey guys i'm trying to test if net/http will reuse connection, but i'm having bad tests, or i'm doing something wrong, because it seems go is creating a new connections each time.. can someone please check the code? http://play.golang.org/p/9aHjHRNTDH
      • nkrs joined the channel
      • if i'm correct Dial should be called only once, and roundtripper should re use previous connection right?
      • nkrs has quit
      • cosql joined the channel
      • cronos
        would be nice to see some runnable code
      • Gouou
        cronos: sure let me change that
      • cronos
        Gouou: also, check your errors
      • you're not using http.NewRequest right
      • kazupon joined the channel
      • Gouou
        cronos: sorry what's wrong with that?
      • AWinterman joined the channel
      • cronos: omg.."HTTP" lol ...my mistake sorry
      • still i think this won't change the outcome
      • irg joined the channel
      • cronos
        still, you have to handle all the errors when trying to find problems in code.
      • bmats_ joined the channel
      • nemothek_ joined the channel
      • tonik has quit
      • irg
        "go get" only recognizes well known repo servers (code.google.com, github, bitbucket, launchpad). I would like to add my own that is inside a intranet environment. How to do it?
      • dominikh
        go help importpath
      • /Remote import paths
      • rafaelhbarros joined the channel
      • Gouou
        cronos: http://play.golang.org/p/9f4uMQmmB7 this should work now
      • cronos: i'm curious to know why is dial called second time, when http.RoundTripper should reuse the last connection
      • nemothekid has quit
      • irg
        dominikh: thanks. just the one I wanted.
      • melody joined the channel
      • rafaelhbarros has quit
      • cronos
      • as i told, check your errrors
      • Guest12930 joined the channel
      • mattrobenolt
        foobaz: ybc might actually be more stable now. I've been running it for a bit now and saturating network io on the machine and he hasn't crashed yet.
      • Sounding promising.
      • AWinterman has quit
      • Gouou
        cronos: well your version works not, but did you catch any error or?
      • cronos
        Gouou: because playground is limited. run that locally
      • e-dard_afk is now known as e-dard
      • only calls Dial once
      • Gouou
        cronos: i'm running it localy, and dial is called once
      • cronos: only thing i see you changed is putting defer body.close() before io.copy
      • Nyxxx joined the channel
      • e-dard is now known as e-dard_afk
      • cronos
        Gouou: in the latest example i check the error from your DL
      • you ignored it
      • and missed the needed info
      • dominikh
        cronos: shouldn't you be returning that error, though? :)
      • cronos
        dominikh: see the latest link ;)
      • dominikh
        gah
      • fair nuff
      • tylersmith has quit
      • tdegrunt joined the channel
      • tylersmith joined the channel
      • Gouou
        cronos: fml, it appears i was testing on a domain not accepting http 1.1 (i didn't test url.com in my example)
      • badbugz has quit
      • cronos: still thanks :)
      • tylersmith has quit
      • tdegrunt has quit
      • chrisfarms joined the channel
      • is it possible to cache dns and use it with roundtripper?
      • rlab joined the channel
      • i mean what i would love to cache is "resolveAddr("dial", network, address, d.deadline())"
      • Problem is that most of the Dial functions are private
      • sspi joined the channel
      • bluetulip joined the channel
      • pietro10 has quit
      • pietro10 joined the channel
      • robot-beethoven
        what's the simplest way to turn a hexadecimal string into an int?
      • dominikh
        strconv.*
      • cronos
        Gouou: you can resolve domain names yourself and pass in bare IPs. but shouldn't OS have some dns caching?
      • badbugz joined the channel
      • dominikh
        I don't think linux has dnc caching by default
      • Gouou
        cronos: sorry can you point me to a good direction here? i mean, i know i can get IP manually, but how do i force http roundtripper to use that ip?
      • cronos
        but it can be turned on, right? without recompiling stuff. should be better than some hand-made solution
      • Gouou: when you pass in the URL use the IP instead of domain name
      • dominikh
        cronos: from what I know, you'd need a local caching dns server, on Linux.
      • raggi
        Gouou: if you make a request to the IP, but set the host header to the host that you resolved yourself, you're done
      • dominikh
        raggi: just from the description, cordova sounds nice. the sort of wrapper around a web view I didn't want to write myself
      • raggi
        dominikh: yep, and these days you just npm install it (which could be worse)
      • dominikh
        npm? aw man
      • raggi
        yeah
      • Gouou
        raggi: yeah i was wondering how to tell what host i need
      • dominikh
        XML, npm, it's going downhill fast :P
      • raggi
        dominikh: i'm done fighting the fact that i have to install node, and just put up with it
      • dominikh
        raggi: it's not so much needing node (I already needed it for some other thing.. keybase, probably), it's that I hadn't had the time/nerve to figure out npm yet or why it won't work without root.
      • raggi
        dominikh: npm works without root
      • dseitz has quit
      • dominikh
        is there a magic switch for user installs? /me goes to google
      • raggi
        npm install thing -> ./node_modules, npm install -g thing -> /usr/local or wheverver
      • dominikh: user installs are default
      • dominikh: maybe some distro package is changing things for you? :(
      • Gouou
        raggi: so i shoulld create a Request https://godoc.org/net/http#Request with url 127.0.0.1/something/what/i/want(example) and put request.Host = url ?
      • raggi
        Gouou: yes :)
      • wait, no
      • dominikh
        raggi: no, copy&pasting like an idiot is. works now, apparently
      • raggi
        request.Host = "example.org:80"
      • dominikh: hehe
      • dominikh: i tend to chmod the global to my user and npm install -g
      • because npms are soooo damn numerous
      • dominikh
        raggi: why?
      • raggi
        otherwise i end up with 500 million copies of the promise library and shit
      • dominikh
        ah
      • raggi
        i mean for apps, eventually (or immediately in a team), i'll go local and commit stuff
      • but for general on my laptop peronsal stuff, i keep it simple and de-dup'd
      • it gets pretty funny, i npm installed karma the other day, with node 0.11 something, and npm downloaded and installed node again, to get headers
      • dominikh
        I like to have all the things that aren't covered by my package manager in my home, for the sake of easier backups
      • Gouou
        raggi: it appears there is no need for :80 based on this http://golang.org/src/pkg/net/http/request.go?s...
      • dominikh
        heh…
      • raggi
        Gouou: right, it was really an example to demonstrate that port should be there when port != 80
      • Gouou
        raggi: oh yeah it makes sanse :) sorry
      • *sense
      • raggi
        Gouou: i should have been explicit
      • dominikh: i think you can drop a ~/.npmrc or some such too, i've never looked into it
      • dominikh
        glad to see that all copy & paste instructions for npm repeat the errors of instructions for rubygems: sudo, and in the cawe of npm, -g
      • but then again, easier than telling people to fix their PATH
      • raggi
        dominikh: yeah, although npm had local installs out the box, but the whole path vs global thing is hard for everyone
      • nkrs joined the channel
      • bmats_ has quit
      • dominikh
        then again, npm defaulting to a directory in the current working directory also caught me off-guard (ignoring whether that makes more sense or not)
      • PSG_Sakari__
        Sooo, I'm making oauth requests now, and I just got an id token
      • raggi
        i had a plan to fix that in rubygems with ruby -S, but then i left
      • PSG_Sakari__
        how do I read that god damned id token >
      • Can't figure that part out
      • ndrei joined the channel
      • bmats_ joined the channel
      • raggi
        PSG_Sakari__: what do you mean by read?
      • PSG_Sakari__
        I'm using goauth2
      • codex0 joined the channel
      • the id token is a bunch of encrypted nonsense
      • and I can't figure out from the goauth2 docs on how to read it
      • mrevil joined the channel
      • aka, decrypt it and get out useful json
      • AWinterman joined the channel
      • tdegrunt joined the channel
      • raggi
        PSG_Sakari__: oauth2 tokens tend to just be random values
      • PSG_Sakari__: they generally don't contain "useful json"
      • PSG_Sakari__
      • See the section about the id token payload
      • It's a base64'd json that's crypto signed
      • raggi
        oh, loaded terms. sorry
      • PSG_Sakari__
        I ment the id tokenm indeed, sorry
      • Not the access/refresh tokens
      • which are indeed nonsense
      • cschneid has quit