--- Log opened Sat Mar 05 00:00:55 2011
00:12 -!- yebyen [~yebyen@martyfunkhouser.csh.rit.edu] has quit [Read error:
Operation timed out]
00:13 -!- yebyen [~yebyen@martyfunkhouser.csh.rit.edu] has joined #go-nuts
00:25 -!- iant [~iant@nat/google/x-ronbcxwmepwotmxt] has quit [Quit: Leaving.]
00:34 < skelterjohn> anyone want to check out the go IDE I've been working
on?  It's still under dev...  can't actually *build* anything yet
00:34 -!- iant [~iant@67.218.107.6] has joined #go-nuts
00:34 -!- mode/#go-nuts [+v iant] by ChanServ
00:34 < aiju> but hey pretty colours?
00:34 < skelterjohn> something like that
00:34 < skelterjohn> been learning all about js and jquery
00:34 < aiju> http://aiju.phicode.de/rant/syntax-highlighting
00:35 < skelterjohn> have a file explorer that ...  works
00:35 < aiju> oh yeah that thing was in JS
00:35 < skelterjohn> oh, you made another blog post?
00:36 < skelterjohn> anyway, the ide is at
https://github.com/skelterjohn/gbide
00:36 < aiju> i have 58 now!
00:36 < rl> You're using javascript in your IDE?
00:36 < aiju> rl: it runs in your browser
00:36 < rl> That's an interesting concept.  What's the motivation for using
an IDE in your browser?
00:36 -!- dfr|mac [~dfr|work@nat/google/x-fkvmcqgecrgdvgdi] has quit [Remote host
closed the connection]
00:36 < aiju> it's hip
00:37 < aiju> cloud and stuff
00:37 < rl> Just putting it in your browser doesn't really make it cloud
computing :p
00:38 < exch_> the idea is to move desktop apps away from silly legacy BS
like AT, GTK, wx and just use a UI toolkit that looks/works the same everywhere
00:38 < exch_> s/AT/QT/
00:39 < aiju> same idea like Java
00:39 < aiju> we can't get it work everywhere, let's just make it suck
everywhere
00:39 < skelterjohn> rl: because that way it will run anywhere
00:39 < exch_> if you're doing it wrong, then yes
00:39 < skelterjohn> and i don't see a nice pure-go UI library
00:39 < aiju> skelterjohn: by "anywhere" you mean on Windows, Linux, OS X
and BSD
00:39 < skelterjohn> yep
00:39 < rl> exch_: Are you telling me that javascript and the DOM model
works the same in all browsers?
00:39 < skelterjohn> i think that's everywhere
00:40 < exch_> r1, nope.  but thats what things like dojo and jquery are for
00:40 < rl> So if you're gonna make a library handle cross-platform
compatibility for you, why not just use Java, as pointed out?
00:40 < skelterjohn> because i don't like writing java code anymore
00:40 < exch_> because I'm using Go
00:41 < skelterjohn> the backend of my IDE is written in go
00:41 < skelterjohn> the frontend is html/js
00:42 < rl> Well "I want to write it in this language" is a fair answer to
my question :) It's just very different from the original answer I got
00:42 < aiju> hahahaahhahahaha Java doesn't work anywhere
00:42 < aiju> Java works on Windows and OSX
00:42 < aiju> if you pray enough it might work on Linux and BSD
00:42 < aiju> it certainly won't work on e.g.  ARM
00:42 < skelterjohn> "anywhere" does not include windows and osx, apparently
00:43 < rl> I don't know, I find running Eclipse on linux works fine
00:43 < aiju> that "Java is portable" myth is BS
00:43 < skelterjohn> i'm pretty sure js is portable :)
00:43 < aiju> ANSI C is portable
00:43 < skelterjohn> lots of people work very hard to make jquery stuff look
the same on all platforms
00:43 < skelterjohn> anyway, js is a really kooky language
00:43 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
00:43 < rl> Yes, it is
00:44 < skelterjohn> i have a hard time understanding why it is the way it
is
00:44 < skelterjohn> or why something better wasn't chosen
00:44 < rl> so why do you write in it?  :p
00:44 < aiju> var undefined = 0;
00:44 < aiju> valid JS
00:44 < exch_> im not having a lot of fund writing the JS bits
00:44 < skelterjohn> to make a GUI
00:44 < skelterjohn> i thought that was clear?
00:44 -!- ako [~nya@fuld-590c623c.pool.mediaWays.net] has joined #go-nuts
00:45 < exch_> this is why i'm currently attempting to allow the writing of
client code in Go, which is translated into optimized and appropriate JS with the
UI lib included
00:45 < skelterjohn> html/js apps can look quite nice, when done right
00:45 < skelterjohn> and i'm good at doing things right, so i'll get there
eventually
00:45 < skelterjohn> exch_: whoah sort of like GWT
00:45 < exch_> no idea what GWT is :p
00:45 < rl> well it'll be interesting to see how it turns out
00:46 < skelterjohn> googles thing that compiles java to js
00:46 < exch_> yea.  chances are it'll be shit, but I think it's worth a try
00:46 < skelterjohn> it just sounds tough
00:46 < aiju> i'll write a Go to PDP-11 compiler
00:46 < aiju> you can run them in my PDP-11 JS emulator then
00:46 -!- JusticeFries [~JusticeFr@173-8-247-218-Colorado.hfc.comcastbusiness.net]
has quit [Quit: JusticeFries]
00:46 < aiju> 64 KB ought to be enough for everyone
00:47 < skelterjohn> well, ideally you wouldn't have to compile go to js.
you'd create some kind of structure in go that would be able to make itself into
js
00:47 -!- aho [~nya@fuld-590c7dd1.pool.mediaWays.net] has quit [Ping timeout: 255
seconds]
00:47 < rl> how would the functions transform themselves to js code?
00:48 < skelterjohn> RPC, presumably
00:48 < rl> so you'd keep the logic serverside?
00:48 < exch_> the logic remain in the webserver
00:48 < skelterjohn> unless you actually compile go to js, no choice
00:48 < exch_> well not all aof it
00:48 < exch_> the stuff that manipulates the UI is in JS ovbiously
00:48 < rl> skelterjohn: sorry, i thought compiling go to js was the goal :p
00:49 < exch_> Just all the data and number crunching should stay on the
server side
00:49 < rl> yeah
00:49 < skelterjohn> the goal is to make a GUI with js without having to
write or know js
00:49 < |Craig|> more importantly, without having to maintain js
00:49 < rl> right but js isn't all datastructures, you need to somehow write
some logic (like "when I click here make this window bigger")
00:49 < rl> and that logic needs to be turned from go into js
00:49 < exch_> Yea, that's the part that should be translated from Go to JS
00:50 < rl> it is starting to sound like GWT though
00:51 -!- zozoR [~Morten@56346ed3.rev.stofanet.dk] has quit [Remote host closed
the connection]
00:51 < rl> where you have server and client side logic, and model classes
that you pass between them through rpcs
00:51 < exch_> So you can basically write the entire app in Go and never
bother worrying about the gritty JS bits.  The build 'framework' (and I use that
term with much hesitation) will do all the hard work of splitting your code up and
generating all the appropriate html/js/etc as well as build the server app
00:52 < exch_> It sounds like GWT I suppose.  Still I have no idea yet how
to make it work properly.  I'm just brainstorming atm and trying some things out
00:52 < rl> so will you port all of go libraries to js versions?  or will
there be separate libraries which are made to be ported to js?
00:52 < rl> and by port I mean "compile"
00:53 < exch_> the JS UI library already exists.  The Go side simply exposes
a thin wrapper to that library allowing you to build the app/logic in Go
00:53 < exch_> once you build the whole thing, it'll spit out the
appropriate calls and setup for the client side based on what you wrote in Go
00:54 -!- tarrant [~tarrant@69.169.141.202.provo.static.broadweavenetworks.net]
has joined #go-nuts
00:54 < exch_> anyhoo, I was watching a movie which i'll go back to now :p
00:54 < rl> well, it sounds cool.  I sort of liked GWT, though it can be a
real pain in the ass at times
00:55 < rl> (and is way too heavy)
00:55 < exch_> Yup, there's definitly the risk of it become way too
convoluted and messy
00:55 < exch_> But I'll find out soon enough :p
00:56 -!- mattn_jp [~mattn@s60.BMT-e1.vectant.ne.jp] has joined #go-nuts
00:56 < exch_> The good thing is that dojo (as opposed to jquery) kinda
lends itself well to this, so I have high hopes for something at least marginally
practical
00:56 < rl> I'm sure you'll re-make a lot of mistakes GWT made (not because
I think you're in the habit of making mistakes, but because I'm sure a lot of them
are unavoidable), would be interesting if there was some way of learning from that
00:56 < rl> i.e.  learning from what GWT did
00:57 < exch_> learning is really the only reason I program anything.  I do
enjoy a good challenge :)
00:59 < rl> that's good :) well, i gotta sleep, seeya
01:01 -!- thomas_b [~thomasb@cm-84.215.47.51.getinternet.no] has quit [Read error:
Operation timed out]
01:01 -!- tobier [~tobier@c-1e9de055.712-1-64736c11.cust.bredbandsbolaget.se] has
quit [Read error: Operation timed out]
01:02 -!- chimes [~chimes@24.104.130.118] has quit [Ping timeout: 241 seconds]
01:03 -!- itrekkie [~itrekkie@ip72-211-129-122.tc.ph.cox.net] has quit [Ping
timeout: 276 seconds]
01:03 -!- clip9 [clip9@er.en.svarteper.com] has quit [Read error: Operation timed
out]
01:03 -!- clip9 [clip9@er.en.svarteper.com] has joined #go-nuts
01:03 -!- brett [~brett@rdnzl.net] has quit [Quit: ZNC -
http://znc.sourceforge.net]
01:04 -!- mbernstein [~michael@cpe-70-113-7-72.austin.res.rr.com] has quit [Read
error: Operation timed out]
01:04 -!- mbernstein [~michael@cpe-70-113-7-72.austin.res.rr.com] has joined
#go-nuts
01:04 -!- brett [~brett@rdnzl.net] has joined #go-nuts
01:05 -!- tobier [~tobier@c-1e9de055.712-1-64736c11.cust.bredbandsbolaget.se] has
joined #go-nuts
01:06 -!- nettok [~quassel@200.119.159.85] has joined #go-nuts
01:06 < skelterjohn> is there an easy standard way to take two files (one
open for reading, the other for writing) and say "everything from YOU goes to YOU"
01:06 < skelterjohn> and then just forget about it?
01:07 < skelterjohn> kind of like the reverse of pipe
01:07 < exch_> io.Copy(dstfd, srcfd)
01:07 < exch_> you still have to open them both manually and close em
01:07 < skelterjohn> thanks!
01:07 < skelterjohn> well sure
01:11 -!- thomas_b [~thomasb@cm-84.215.47.51.getinternet.no] has joined #go-nuts
01:16 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
01:18 -!- nettok [~quassel@200.119.159.85] has quit [Ping timeout: 255 seconds]
01:28 -!- shvntr [~shvntr@113.84.144.217] has joined #go-nuts
01:38 -!- ronnyyy [~quassel@p4FF1C6D8.dip0.t-ipconnect.de] has quit [Ping timeout:
250 seconds]
01:44 < KBme> hahahah
01:44 < KBme> [aiju] we can't get it work everywhere, let's just make it
suck everywhere
01:45 < KBme> isn't there allready a javascript editor from the moztards?
01:46 -!- xyproto [~alexander@77.40.159.131] has quit [Ping timeout: 252 seconds]
01:48 -!- Wiz126 [~Wiz@h29.117.232.68.ip.windstream.net] has quit []
01:49 -!- xyproto [~alexander@77.40.159.131] has joined #go-nuts
01:49 -!- m4dh4tt3r [~Adium@c-69-181-223-245.hsd1.ca.comcast.net] has quit [Quit:
Leaving.]
01:54 -!- dforsyth_ [~dforsyth@ec2-50-18-22-230.us-west-1.compute.amazonaws.com]
has joined #go-nuts
01:56 -!- steevel [steevel@yahoe.se] has joined #go-nuts
01:58 -!- dRbiG [drbig@unhallowed.pl] has quit [Ping timeout: 241 seconds]
02:00 -!- tarrant [~tarrant@69.169.141.202.provo.static.broadweavenetworks.net]
has quit [Read error: Operation timed out]
02:00 -!- mattn_jp [~mattn@s60.BMT-e1.vectant.ne.jp] has quit [Quit: Ex-Chat]
02:01 -!- jessta [~jessta@li7-205.members.linode.com] has quit [Ping timeout: 252
seconds]
02:01 -!- jessta [~jessta@li7-205.members.linode.com] has joined #go-nuts
02:02 -!- perdiy [~mkhl@sxemacs/devel/perdix] has joined #go-nuts
02:02 -!- Netsplit *.net <-> *.split quits: dforsyth, krakensden, Zoopee,
steevel_
02:03 -!- Netsplit over, joins: Zoopee, krakensden
02:04 -!- perdix [~mkhl@sxemacs/devel/perdix] has quit [Ping timeout: 255 seconds]
02:05 -!- dRbiG [drbig@unhallowed.pl] has joined #go-nuts
02:07 -!- itrekkie [~itrekkie@ip72-211-129-122.tc.ph.cox.net] has joined #go-nuts
02:09 -!- m4dh4tt3r [~Adium@adsl-75-61-193-22.dsl.pltn13.sbcglobal.net] has joined
#go-nuts
02:09 -!- iant [~iant@67.218.107.6] has quit [Quit: Leaving.]
02:13 -!- rseymour [~rseymour@cacsag4.usc.edu] has quit [Quit: I'm outta
heee-eere]
02:13 -!- binarypie [~binarypie@adsl-99-35-135-146.dsl.pltn13.sbcglobal.net] has
quit [Ping timeout: 255 seconds]
02:14 -!- dRbiG [drbig@unhallowed.pl] has quit [Ping timeout: 276 seconds]
02:15 -!- boscop [~boscop@g227152143.adsl.alicedsl.de] has quit [Ping timeout: 255
seconds]
02:20 -!- saturnfive [~saturnfiv@219.145.58.122] has joined #go-nuts
02:23 -!- tensorpudding [~user@99.23.127.179] has quit [Read error: Connection
reset by peer]
02:23 -!- steven [~steven@unaffiliated/steven] has joined #go-nuts
02:23 < steven> hello
02:23 < steven> whats the most built-in way to convert a []byte to a string?
02:24 < steven> im sure this is simple but i cant find it in the doc pages
02:26 -!- tensorpudding [~user@99.56.160.152] has joined #go-nuts
02:28 < drhodes> steven: string([]byte{...}) will do it.
02:29 <@adg> steven: for the []byte b, string(b)
02:29 < steven> hmm..  but im curious, why will that work?  i dont see in
the documentation explaining it
02:29 <@adg> it's just a type conversion
02:29 < steven> oh.
02:29 < steven> that makes sense :)
02:30 < steven> how do you declare that your own type is convertable from
one type to another?
02:31 < steven> for example, i have "type TestString []byte" and im not able
to do "string(v)" for "var v TestString", instead i have to do "string([]byte(v))"
02:32 -!- dRbiG [drbig@unhallowed.pl] has joined #go-nuts
02:32 < edsrzf> string(v) should work
02:32 < edsrzf> In that case
02:32 < edsrzf> It compiles for me, anyway.
02:33 < steven> test.go:18: cannot convert b (type TestString) to type
string
02:34 < steven> test.go:18: cannot convert b (type TestString) to type
string
02:34 < steven> sorry
02:34 < edsrzf> Oh, whoops, I typed it in wrong.
02:34 -!- saturnfive [~saturnfiv@219.145.58.122] has left #go-nuts []
02:34 < edsrzf> You're right.
02:36 < edsrzf> Seems like that should work to me, but the spec doesn't make
it sound that way.
02:38 < steven> weird
02:39 < steven> i really like go.
02:39 < steven> its like c v2
02:45 < steven> does Go have an FFI to C?
02:45 < steven> or a way to communicate to C progrums?
02:45 < cbeck> Yes, cgo
02:45 < steven> *prohgrumms
02:45 < steven> cool
02:46 < cbeck> Erm
02:46 < cbeck> Programs or libraries?
02:46 < steven> well basically im curious if i can write Cocoa bindings for
Go.
02:47 < steven> so im wondering if Go can utilize C libraries and if C can
utilize Go libraries
02:47 < steven> since they're fundamentally different languages, im assuming
not.
02:58 < Xenith> Yep, using cgo, you can use C libraries/code within Go.
03:04 < skelterjohn> cocoa bindings for go would be entirely possible
03:04 < skelterjohn> i think i've heard others talk about doing it, before
03:05 < skelterjohn> nothing on any of the project lists
03:12 < steven> i think that would be fun.  id love to get started on it.
03:15 -!- dfr|mac [~dfr|work@ool-182e3fca.dyn.optonline.net] has joined #go-nuts
03:28 -!- shvntr [~shvntr@113.84.144.217] has quit [Ping timeout: 260 seconds]
03:32 <@adg> you might have trouble with objective-c and cgo
03:32 <@adg> objective-c has a runtime, yes?  and so does go
03:33 -!- werdan7 [~w7@freenode/staff/wikimedia.werdan7] has joined #go-nuts
03:33 <@adg> c and c++ libraries link well because they're just object
files, any initialization is application-level
03:33 <@adg> objc might be more difficult - but i'm not an objective-c
expert, though, and would like to know more about it
03:34 < skelterjohn> objc's runtime is a bit sneakier
03:34 < skelterjohn> it's not like go's runtime
03:34 < skelterjohn> but it still might cause problems
03:34 < skelterjohn> they have an event loop that must be running in order
for memory management to work
03:35 < skelterjohn> but i think it might be possible to invoke that from a
goroutine
03:35 <@adg> i've tried to get go-sdl working with cgo under osx, but had
problems that i believe are related to both objective-c and go wanting to be
main()
03:35 <@adg> i should give it another try
03:35 < skelterjohn> sdl has an ego complex
03:35 <@adg> the difficulty was compounded by that, yes, in that sdl uses a
C macro to rewrite user-defined main functions :/
03:35 < skelterjohn> it wasn't objective C that needed to be main - it was
SDL
03:36 <@adg> last time i tried i spent hours and got nowhere, so i'm not
keen to dive in again :|
03:37 < skelterjohn> i'm exploring the js angle to go gui
03:37 < skelterjohn> launch a server and browser
03:37 -!- m4dh4tt3r [~Adium@adsl-75-61-193-22.dsl.pltn13.sbcglobal.net] has quit
[Quit: Leaving.]
03:37 < skelterjohn> it's portable, at least :)
03:37 <@adg> indeed
03:37 <@adg> and you can run it over the network, hurrah
03:38 <@adg> i just wrote this
http://nf.id.au/collecting-and-plotting-live-data-with-golang
03:39 < steven> hey guys,
03:39 < steven> i totally misunderstood how if's assignment works
03:39 < steven> im trying to write idiomatic error handling in go, and i
suspect im not supposed to write a huge pyramid of ifs
03:40 < steven> but i thought if you assigned variables in an if statement's
first half, that might be a useful way to ..  i dunno
03:40 < steven> i guess im crazy.  hold on.
03:40 <@adg> the idea is to handle the errors and bail
03:41 <@adg> if err := foo(); err != nil {
03:41 <@adg> return err
03:41 <@adg> }
03:41 < steven> right.  but foo() has multiple assignment.
03:41 < steven> ahh crap.  im gonna have to define the vars above the if
statement, arent i
03:41 < steven> i dont see a way around it.
03:41 <@adg> so define it outside the if statement, if it returns values
you'll need later
03:41 < steven> or i can just check the value in the if statement without
that assignment trick
03:41 <@adg> yes, the latter
03:41 < steven> or i can just check the value in the if statement without
that assignment trick
03:42 < steven> grrr
03:42 < steven> second time thtas happened tonight.  i must be drunk.
03:42 < steven> anyway which would you do?
03:42 <@adg> make the function call outside the if statement
03:42 < steven> k
03:42 < steven> is there a more idiomatic way to bail by printing an exiting
than fmt.Printf() followed by os.Exit?
03:42 <@adg> log.Fatal
03:42 < steven> maybe os.Bail?  thatd be sweet.
03:43 < steven> oh cool.
03:43 <@adg> or log.Fatalf
03:43 < skelterjohn> painc() :)
03:43 < steven> panic shows stacktrace thats not needed
03:43 < steven> interesting that interface{} is very much like ObjC's id,
but not exactly
03:43 < steven> but close enough
03:44 < skelterjohn> shares use if not meaning
03:45 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has joined #go-nuts
03:45 -!- mode/#go-nuts [+v iant] by ChanServ
03:47 < steven> does go have default args?
03:47 <@adg> steven: no
03:47 < skelterjohn> what do you mean
03:47 < steven> aww.  sadface.
03:47 < skelterjohn> oh
03:48 < steven> i miss those.
03:49 < skelterjohn> default args were the sort of thing that, when i used
them, i would think "man i am so slick look at my code!"
03:49 -!- Eridius [~kevin@unaffiliated/eridius] has quit [Quit: leaving]
03:49 < skelterjohn> for situations where default arguments are appropriate,
i'll make a struct for the arg and a DefaultArg() (ArgStruct) method
03:50 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has quit [Ping
timeout: 264 seconds]
03:50 < steven> is that something in the language itself?
03:51 -!- iant [~iant@216.239.45.130] has joined #go-nuts
03:51 -!- mode/#go-nuts [+v iant] by ChanServ
03:51 < steven> or just some convention you personally use for yourself
only?
03:51 < skelterjohn> the latter
03:51 < skelterjohn> other people can use it too, if they like :)
03:51 < skelterjohn> i also wrote a tool that populates structures like
these from command line args
03:51 < steven> heh
03:52 < steven> woot, my first go program..  it doesnt work right at all,
but it almost does so thats something!
03:52 < steven> https://gist.github.com/856090
03:53 < steven> any criticisms (read: tearing this code apart) would be
welcomed :)
03:54 < skelterjohn> run gofmt on it :)
03:54 < skelterjohn> it hurts my eyes
03:55 < skelterjohn> don't do if cond { then }
03:55 < skelterjohn> do if cond { \n then \n }
03:55 < steven> i know, i wouldnt normally do it.
03:55 < steven> but i was getting annoyed at the fact that i cant do:
if()\n\tSomeCode(); like in C
03:55 < skelterjohn> one thing you might try
03:55 < skelterjohn> if err != nil { return }
03:56 < skelterjohn> defer log.Fatalf(err)
03:56 < steven> that will always exit with an error though.
03:56 < steven> which is not what i want.
03:56 < skelterjohn> well
03:56 < skelterjohn> put in a condition
03:56 < skelterjohn> was too lazy to type that bit
03:56 < steven> :P
03:56 < steven> the process seems to be ignoring my arguments sadly
03:57 < skelterjohn> []string{"-l", "."} should be []string{"ls", "-l", "."}
03:58 < steven> oh.  ouch.
03:59 < steven> adg: what do you think of the code?  im sure theres a lot of
bad paradigms im using and im probably not doing it as idiomatically as i could
04:00 < skelterjohn> it's too strange of a thing to want to do to be either
idiomatic or unidiomatic
04:01 < steven> im talking about the details of the code more
04:01 < steven> like how i made the pipe and the file descriptors etc
04:01 < steven> and how i worked with strings at the end
04:02 < edsrzf> Instead of execing ls, I would have opened the directory
with os.Open and then called Readdirnames on it.
04:02 < skelterjohn> oh, there is that
04:02 < skelterjohn> but i assumed he wanted to do something with pipes
04:03 < steven> yeah i wanted to do something lower level
04:03 < steven> ls is jsut a detail, it could have been "cat" or "python"
for all i care
04:03 < edsrzf> Yeah, fair enough.
04:04 < steven> but i like your idea
04:04 < steven> ok fun question:
04:05 < steven> how would you implement a small, dumb telnet client in go?
04:05 < steven> in C i would use select() or kqueue()..  would select with
channels be the best way in Go? or is there a btter way?
04:05 < skelterjohn> io.Copy(os.Stdin, theNetworkWriter) :)
04:05 < skelterjohn> is a telnet client multi-threaded?
04:05 < steven> no
04:06 < skelterjohn> why would you need select, then?
04:06 < steven> oh, i dont know.
04:06 < skelterjohn> just copy stdin to the writer, stdout to the reader
04:06 < exch_> "io.Copy(os.Stdin, theNetworkWriter)" best switch those
params around, unless you intend to write to stdin
04:06 -!- GoBIR [~gobir@70-90-168-190-SFBACalifornia.hfc.comcastbusiness.net] has
quit [Ping timeout: 248 seconds]
04:06 < steven> hehe
04:06 < skelterjohn> yes yes
04:07 < steven> so i guess what im thinking is..  how would one go about
writing a basic loop-ish program where all it does is read info from the TCP
connection, print it to stdout, read input from stdin, and send it to the TCP
connection?
04:07 -!- Eko [~eko@70-90-168-190-SFBACalifornia.hfc.comcastbusiness.net] has quit
[Ping timeout: 240 seconds]
04:07 < steven> i mean, how would that be structed?  would it be a simple
semi-infinite for-loop that just does sychronous reads?
04:08 -!- Eko [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has joined #go-nuts
04:08 < steven> or is there a way to do async reads of files/io's?
04:08 < exch_>
https://github.com/jteeuwen/Calculon/blob/master/bot/net/network.go here's an
example.  particularly the input/outputLoop methods
04:08 < skelterjohn> go io.Copy(networkReader, os.Stdin)
04:08 < steven> sweet, thanks
04:08 < exch_> they both run on separate goroutines
04:08 < steven> skelterjohn: ahh, nice.
04:08 < skelterjohn> go io.Copy(os.Stdout, theWriter)
04:08 -!- GoBIR [~gobir@c-24-130-224-186.hsd1.ca.comcast.net] has joined #go-nuts
04:09 < steven> so that would be an infinite loop, until someone manually
calls os.Exit, right?
04:09 < steven> that seems fair enough, honestly.
04:09 < exch_> make sure you close your connection before os.Exit is called
04:09 < steven> touche, thanks
04:10 < steven> are there any methods on primitive types like int, byte,
string, etc?
04:10 < steven> or must they be casted first to something in, say,
http://golang.org/pkg/ first?
04:12 < exch_> not sure what you mean by that
04:12 < exch_> primitive types have no methods.  If you want to add some for
whatever reason, you'll have to 'subtype' it.  eg: type MyInt int; func (m MyInt)
SomeFunc() { ...  }
04:12 < steven> right, thats what i thought.
04:12 < exch_> that's not an alias btw.  Myint is a completely separate type
which can be treated as an int if you need it to
04:13 < steven> so any "built-in string operations" i want to look for, i
would only be able to find in one of the packages, maybe bytes or strings, etc,
right?
04:13 < steven> right, i remember that.
04:13 < exch_> yes.  strings package, bytes package, utf or unicode packages
as well
04:13 < exch_> *utf8
04:13 < steven> sweet.  thanks.
04:13 -!- shvntr [~shvntr@113.84.144.217] has joined #go-nuts
04:14 < skelterjohn> gotten tired of writing makefiles yet?
04:16 -!- itrekkie [~itrekkie@ip72-211-129-122.tc.ph.cox.net] has quit [Quit:
itrekkie]
04:21 < steven> i havent touched a makefile
04:21 < steven> `6g test.go && 6l test.6 && ./6.out` hehe
04:24 -!- _Eko_ [~eko@70-90-168-189-SFBACalifornia.hfc.comcastbusiness.net] has
joined #go-nuts
04:24 < steven> oh but how would you guys loop the main thread?  or would
you use a channel instead?
04:24 < steven> i think a channel makes more sense.  a "done" channel, size
1, and as soon as it accepts, it knows its done.
04:26 < skelterjohn> if you just need the main() to not exit until a signal,
that's a normal way yea
04:26 -!- GoBIR [~gobir@c-24-130-224-186.hsd1.ca.comcast.net] has quit [Ping
timeout: 248 seconds]
04:26 < exch_>
https://github.com/jteeuwen/Calculon/blob/master/bot/main.go#L41
04:26 < skelterjohn> if you want to just wait, select {}
04:26 < steven> ok.  thanks.
04:27 < steven> also im curious, is there a package that simplifies reading
bytes from file.Read()?
04:27 < skelterjohn> bufio
04:27 < steven> thanks
04:27 < exch_> if you want to read everything from a file at once, you can
use ioutil.ReadFile()
04:27 -!- Eko [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has quit [Ping timeout:
255 seconds]
04:27 < exch_> otherwise the bufio is indeed a good option
04:28 < steven> sweeet..  i like Reader.ReadString() :)
04:29 -!- _Eko_ [~eko@70-90-168-189-SFBACalifornia.hfc.comcastbusiness.net] has
quit [Ping timeout: 255 seconds]
04:31 < steven> uhh..  crap
04:32 < steven> there must something about select that i dont understand,
04:32 < steven> because when i do "go func() { ...  }()" twice in a row,
followed by "select {}", only the first goroutine seems to get executed.
04:33 < skelterjohn> GOMAXPROCS
04:33 < skelterjohn> ?
04:33 < skelterjohn> it's possible your first invoked goroutine never yields
04:33 < skelterjohn> goroutines aren't threads - they have to be friendly if
they're going to share
04:34 < steven> oh.  yeah this goroutine is literally just an infinite for
loop.
04:34 < steven> would you recommend channels for this?
04:34 < skelterjohn> tjat
04:34 < skelterjohn> that'll do it
04:34 < skelterjohn> for what?
04:34 < Namegduf> Nah, just actually do something.
04:34 < Namegduf> You'll yield inherently.
04:34 < steven> i want to make both of my goroutines execute simultaneously
somehow
04:34 < skelterjohn> have them both print stuff
04:35 < steven> they both are.
04:35 < skelterjohn> using fmt.Println
04:35 < skelterjohn> not just println
04:35 < steven> they both do fmt.Printf
04:35 < skelterjohn> then they should both be yielding
04:35 < skelterjohn> gist?
04:35 < steven> https://gist.github.com/856120
04:36 < steven> ooh
04:36 < steven> sorry, refrsh it.  thats what im currently running.
04:37 < steven> oooooooooooh.  yeah, im stupid.
04:37 < steven> its working just fine.
04:37 < steven> its just that in the billion-lines-printed-per-second for
the first goroutine, im not seeing the one-line-per-minute printed in the other.
04:37 < steven> sorry.
04:37 < skelterjohn> prints &{0 /dev/stdin <nil> 0} over and over
again
04:37 < skelterjohn> ah
04:39 -!- katnev [~user@CPE-124-189-81-145.azsz1.cht.bigpond.net.au] has joined
#go-nuts
04:40 < steven> oh btw, is it possible in Go to read a character from the
keybaord as soon as it is pressed, instead of waiting until enter is pressed?
04:41 < skelterjohn> try calling os.Stdin.Read()
04:41 < KirkMcDonald> stdin will be line-buffered by default, won't it?
04:41 < skelterjohn> no idea
04:41 < steven> it seems so.
04:41 < steven> sigh.
04:41 < skelterjohn> how does curses get around this?
04:41 < KirkMcDonald> With the appropriate syscalls, you can change how it
is buffered.
04:41 < steven> a stty probably
04:41 < steven> err, pty
04:42 < KirkMcDonald> But don't look to me for the details.  :-)
04:42 < steven> hehe
04:43 < exch_> you'll have to fiddle with termios for that.  It's not gonna
be a very portable solution though
04:43 < exch_> that's most likely why Go has no facility for that in the
libs
04:43 < steven> sadface.
04:43 < steven> well thats fine.
04:45 < steven> ugh, i was assuming ^C would made a defer run
04:45 < steven> but im misunderstanding either what ^C does (maybe not
panic?) or how defer works with panics (maybe not at all?)
04:45 < skelterjohn> panic is not the same as interrupt
04:46 < skelterjohn> defer and panic do work together, though
04:46 < skelterjohn> you can recover() from a panic in a defer
04:46 < steven> right.  i rememer now.
04:46 < exch_> ^C sends SIGKILL which immediately kills the process iirc
04:46 < steven> hmm, how do we handle signals?
04:46 < steven> wait, signal package maybe
04:46 < exch_>
https://github.com/jteeuwen/Calculon/blob/master/bot/main.go#L41
04:46 < exch_> like that
04:47 < exch_> that example only handles unix signals though.  I have no
clue how to implement that behaviour for windows/OSX
04:47 < exch_> presumably osx works the same though
04:47 < steven> osx = unix
04:48 < exch_> yes
04:48 < steven> anyway, you have to use select?
04:48 < exch_> If you listen on multiple channels like I do in that loop,
then yes
04:48 < steven> oh.  i dont.
04:48 < exch_> otherwise you dont strictly have to use select
04:49 < steven> oh, signal.Incoming is a channel in itself.
04:49 < steven> i thin i get it
04:49 < exch_> yup
04:49 < steven> sweet.
04:49 < steven> actually i think this makes select a lot less scary
04:49 < steven> i never understood select.  i think i finally might.
04:49 < exch_> it simply pollse both those channels (net.In and
signal.Incoming) an handles what ever case fires first
04:50 < steven> it doesnt inherently loop itself, right?
04:50 < exch_> nope
04:50 < exch_> hence the for { ..  }
04:50 < steven> ah thats why.
04:50 < steven> sweet.
04:50 < steven> this is making a lot more sense.
04:51 < steven> so technically speaking, i could implement 2 goroutines, 1
for stdin and one for the TCP connection (reads), and those goroutines could, when
they receive data, push it into the channel, and i could listen in a select call
for each channel and handle them there instead of inside the gorotines?
04:51 < steven> if that works, then that seems cleaner than what im doing
now.
04:51 < exch_> yes
04:52 < steven> sweet.  so select is go's version of select(), but instead
of using files it uses chans
04:52 < steven> kinda
04:52 < steven> sorta
04:52 < exch_> ya
04:53 < steven> why is it that a statement automatically yields to other
threads, but an empty for loop doesnt?
04:54 < steven> and do all statements yield automatically?
04:54 < skelterjohn> no
04:54 < skelterjohn> just system calls, io, some other things
04:54 < skelterjohn> but not, for example, calling a function written in go
04:55 < skelterjohn> unless it does something inside to yield
04:55 < skelterjohn> and not arithmetic
04:56 < steven> can you manually yeild?
04:57 < skelterjohn> runtime.Gosched()
04:57 < steven> oh ok.
04:57 < skelterjohn> or time.Sleep(somenanoseconds)
04:57 < steven> ah.
04:57 < skelterjohn> i'm going to sleep
04:57 < skelterjohn> enjoy yourself
04:57 < steven> btw, when does it ever make sense to have a send-only chan
or a receive-only chan?  i mean, can that inherently even exist?
04:57 < steven> thanks
04:58 < skelterjohn> you create a regular chan
04:58 < skelterjohn> and give it to smeone else as send-only
04:58 < skelterjohn> and another someone as recv-only
04:58 < steven> ooooh.  nice.
04:58 < steven> man you're smart.
04:58 < skelterjohn> it's sort of like a guarantee - a function with param
<-chan int will never send anything on that chan
04:58 < steven> goodnight and God bless you <3
04:59 < exch_> func Foo() <-chan int { ...  } that returns a read-only
channel
04:59 < steven> right.  nice.
04:59 < Rennex> somehow i'm reminded of const-correctness :x
04:59 < steven> :D
05:13 -!- rl [~rbl@84-74-142-37.dclient.hispeed.ch] has quit [Ping timeout: 240
seconds]
05:17 < steven> what the heck is this??
05:17 < steven> sig.(signal.UnixSignal)
05:18 < exch_> it dloes a type assertion to see if the received signal is a
signal.UnixSignal
05:18 < exch_> *does
05:18 < exch_> if it is, ok will be true
05:18 < exch_> This is goes way of doing typeof(v) == SomeType
05:18 < exch_> more or less
05:19 < exch_> *Go's way
05:19 -!- bjarneh [~bjarneh@190.84-48-119.nextgentel.com] has joined #go-nuts
05:20 < steven> i thought go was typesafe though?
05:20 < cbeck> It is
05:21 -!- Null-A [~Null-A@c-24-5-83-123.hsd1.ca.comcast.net] has joined #go-nuts
05:21 < Namegduf> Type assertions are type checked in the "ok" form, you
just need to make sure you handle the default case (nothing matched) right.
05:22 < cbeck> A type assertion makes atomic the old java "if (a instanceof
A) b = (A) a"
05:23 < steven> what are the 2 reutnr values of a tpe assertion?
05:23 < steven> (sorry my finger are cold)
05:23 < Namegduf> v, ok := x.(type)
05:23 < Namegduf> ok is whether the type matched
05:23 < Namegduf> v is either the value of the type, or 0 if it did not
match.
05:23 < steven> oh.
05:24 < steven> thanks
05:24 < exch_> the type assertion only works on interfae values.: var a
interface{}; a = 123; if n, ok := a.(int); ok { yayWeHaveInt(n) }
05:25 < Namegduf> It doesn't make sense on non-interfaces, because you
*know* their type.
05:25 < exch_> you can do that in a switch statement (type switch) to:
switch v := a.(type) { case int: ....; case string: ...  }
05:25 < exch_> ya
05:26 < steven> woot, i can feel my code getting slightly cleaner:
https://gist.github.com/856150
05:26 -!- keithcascio [~keithcasc@nat/google/x-rwymkwbkcuhosxgx] has quit [Quit:
Leaving]
05:26 -!- Null-A [~Null-A@c-24-5-83-123.hsd1.ca.comcast.net] has left #go-nuts []
05:27 < exch_> You are exiting on any unix signal without checking which
signal you are getting.  This may also trigger when you simply resize your shell
window
05:27 < exch_> it sends Resize signals
05:28 < steven> i didnt know how to convert it into an int to check against
2 (ie sigint)
05:28 < steven> oh maybe i need to explicitly conver tit
05:29 < steven> yep.  int(sig) did it.
05:29 < steven> thanks
05:29 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
05:33 < steven> sweet, i can do `pbpaste | gofmt | gist` now.
05:33 < steven> :)
05:35 < steven> wow i have a spiderweb of a mess on my hands here...
05:38 < steven> theres waaaay too many exit points and entry points in this
code.  it needs to get a lot simpler.
05:40 -!- nettok [~quassel@200.119.150.80] has joined #go-nuts
05:48 -!- Eko [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has joined #go-nuts
05:50 -!- lucid [~rbl@84-74-142-37.dclient.hispeed.ch] has joined #go-nuts
05:55 <@adg> steven: notice that checkFail is not worth its weight
05:55 <@adg> steven: also, you can just write log.Fatal("Error:", e)
05:55 <@adg> steven: check the docs for fmt.Print, it's a really nicely
designed print function
06:00 -!- _Eko_ [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has joined #go-nuts
06:02 -!- Eko [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has quit [Ping timeout:
255 seconds]
06:03 -!- tarrant [~tarrant@69.169.141.202.provo.static.broadweavenetworks.net]
has joined #go-nuts
06:08 -!- bjarneh [~bjarneh@190.84-48-119.nextgentel.com] has quit [Ping timeout:
248 seconds]
06:09 < steven> adg: yeah im not sure what to do with checkFail, because i
know that would be really commonly used and thus a lot of duplication, but its
just one simple line.
06:10 -!- crazy2be [~justin@S01060012171a573b.cg.shawcable.net] has joined
#go-nuts
06:11 < crazy2be> does doing &(*obj) make a copy of obj?
06:11 < tarrant> Anyone know of a api that can do most dns lookups?  As in
beyond MX, CNAME, SRV and A?
06:12 < |Craig|> crazy2be: that copies a pointer to obj I think
06:13 < crazy2be> |Craig|: well the * would dereference, and then the &
would take the address of, and that could be interpreted in a few different ways
by the compiler
06:13 < |Craig|> if *obj made a copy, you could never modify something by
referance
06:13 < crazy2be> but if that doesn't work, then how does one copy a struct
that they have a pointer to?
06:14 < steven> ok ive updated it...  https://gist.github.com/856170
06:14 < |Craig|> assign another struct to it by value
06:14 < steven> is there a more idiomatic way to ensure channels are closed
than to check closed() and close() conditinoally?
06:14 < |Craig|> a=*b
06:14 < steven> especially when i have several channels, that can be
cumbersome
06:15 < |Craig|> crazy2be: be aware that I'm not too sure about any of this,
don't trust me too much
06:15 < |Craig|> crazy2be: Its the assign that copies, not the * or &, which
explains it I believe
06:17 < |Craig|> you are right though, it is a bit deeper than i initially
thought.  a=*b ; c=&a is not the same as c=&*b if I'm right
06:17 < crazy2be> hmm, that's tricky
06:17 < crazy2be> but it seems to work properly
06:17 < |Craig|> interesting issue.  I'd never though of it before
06:18 < crazy2be> well i guess &(*obj) does nothing but waste cpu cycles
06:19 < crazy2be> but you could also see why one might think it would copy
06:20 -!- bjarneh [~bjarneh@190.84-48-119.nextgentel.com] has joined #go-nuts
06:21 < crazy2be> i wonder if there is a faster way than b = *a, c = &b tho
06:27 <@adg> steven: don't close the channels
06:27 <@adg> steven: just have a 'shutdown' channel
06:28 <@adg> steven: add "shutdown chan bool" to your IRCBot struct, and add
a case <-bot.shutdown to Loop's select
06:28 <@adg> steven: and then just put "bot.shutdown <- true" in Cleanup
06:28 <@adg> much cleaner
06:29 <@adg> crazy2be: & takes takes the address of a value, so &(*v) is
just returning v
06:30 <@adg> crazy2be: faster in what sense?!
06:30 <@adg> crazy2be: one line instead of two?
06:32 < crazy2be> well, yes, i suppose
06:32 < Namegduf> crazy2be: a = b copies b.
06:32 < Namegduf> If b is a reference type/pointer, it just copies the
pointer.
06:32 < crazy2be> but two lines is fine
06:33 < crazy2be> i was just a bit confused by that, although i suppose it
makes sence
06:33 < Namegduf> Well, it's what assignment does.
06:33 < Namegduf> Blame "everything is a reference" languages
06:41 -!- zozoR [~Morten@56346ed3.rev.stofanet.dk] has joined #go-nuts
06:47 < steven> adg: but i want to close the channels so that the goroutines
know they should stop trying to read input from whatever io object they have
06:48 -!- steven_t [~steven_t@c-98-206-191-14.hsd1.il.comcast.net] has joined
#go-nuts
06:48 < crazy2be> wait why would this cause an index out of range exception?
06:48 < crazy2be> dirs [len(dirs)-1] = dir
06:48 < steven_t> woot im a bot lol hhe
06:48 -!- steven_t [~steven_t@c-98-206-191-14.hsd1.il.comcast.net] has left
#go-nuts []
06:49 < crazy2be> er, panic
06:49 < steven> crazy2be: because len(dirs) == 0
06:49 < steven> you probably did make(whatever) without giving it a size, ie
make(whatever, size)
06:50 < crazy2be> oops, right
06:51 < crazy2be> i forgot to address that contingency...
06:53 < steven> ;)
06:53 < steven> i only know cuz i ran into that earlier too :D
06:53 -!- perdix [~mkhl@sxemacs/devel/perdix] has joined #go-nuts
06:54 -!- perdiy [~mkhl@sxemacs/devel/perdix] has quit [Ping timeout: 252 seconds]
07:04 -!- davvid [~davvid@208-106-56-2.static.dsltransport.net] has quit [Remote
host closed the connection]
07:14 -!- shvntr [~shvntr@113.84.144.217] has quit [Read error: Operation timed
out]
07:17 < crazy2be> night all
07:17 < crazy2be> and thanks for your help steven :)
07:18 -!- crazy2be [~justin@S01060012171a573b.cg.shawcable.net] has quit [Remote
host closed the connection]
07:20 -!- _Eko_ [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has quit [Read error:
Operation timed out]
07:20 -!- Eko [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has joined #go-nuts
07:27 -!- aho [~nya@fuld-590c623c.pool.mediaWays.net] has quit [Ping timeout: 255
seconds]
07:50 -!- shvntr [~shvntr@113.84.144.217] has joined #go-nuts
07:50 -!- photron [~photron@port-92-201-10-205.dynamic.qsc.de] has joined #go-nuts
08:02 -!- piranha [~piranha@5ED4B890.cm-7-5c.dynamic.ziggo.nl] has joined #go-nuts
08:03 < str1ngs> I have some C enum/constants generated godefs that I need
to translate into error messages.  should I use a switch or is there a better way
to do that?
08:06 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has joined #go-nuts
08:11 -!- mbernstein [~michael@cpe-70-113-7-72.austin.res.rr.com] has quit [Ping
timeout: 255 seconds]
08:28 -!- femtoo [~femto@95-89-198-8-dynip.superkabel.de] has joined #go-nuts
08:33 -!- GoBIR [~gobir@c-24-130-224-186.hsd1.ca.comcast.net] has joined #go-nuts
08:36 -!- nettok [~quassel@200.119.150.80] has quit [Ping timeout: 246 seconds]
08:38 -!- femtoo [~femto@95-89-198-8-dynip.superkabel.de] has quit [Read error:
Connection reset by peer]
08:38 -!- tensorpudding [~user@99.56.160.152] has quit [Remote host closed the
connection]
08:43 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
08:58 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
08:59 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
09:04 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
09:10 < aiju> str1ngs: a map
09:10 < aiju> or wait, those are integers?  an array is it, then
09:15 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
09:19 -!- araujo [~araujo@190.38.51.34] has joined #go-nuts
09:19 -!- araujo [~araujo@190.38.51.34] has quit [Changing host]
09:19 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
09:26 < str1ngs> aiju: ok I'll have to check if they are int.  but that
makes sense thank you
09:39 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-171-187.clienti.tiscali.it] has
joined #go-nuts
09:45 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
09:48 -!- viirya_ [~viirya@cml506-25.csie.ntu.edu.tw] has quit [Read error:
Connection reset by peer]
09:48 -!- viirya [~viirya@cml506-25.csie.ntu.edu.tw] has joined #go-nuts
09:52 -!- visof [~visof@unaffiliated/visof] has quit [Ping timeout: 252 seconds]
09:53 -!- Project-2501 [~Marvin@82.84.98.115] has joined #go-nuts
09:56 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-171-187.clienti.tiscali.it] has
quit [Ping timeout: 264 seconds]
09:57 -!- boscop [~boscop@f050133076.adsl.alicedsl.de] has joined #go-nuts
10:03 -!- visof [~visof@41.238.234.59] has joined #go-nuts
10:03 -!- visof [~visof@41.238.234.59] has quit [Changing host]
10:03 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
10:15 -!- coldturnip [~COLDTURNI@111-250-7-7.dynamic.hinet.net] has quit [Read
error: Connection reset by peer]
10:15 -!- katnev [~user@CPE-124-189-81-145.azsz1.cht.bigpond.net.au] has quit
[Ping timeout: 276 seconds]
10:16 -!- coldturnip [~COLDTURNI@111-250-7-7.dynamic.hinet.net] has joined
#go-nuts
10:25 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
10:29 -!- ronnyy [~quassel@p4FF1C202.dip0.t-ipconnect.de] has joined #go-nuts
10:30 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.4]
10:30 -!- wrtp [~rog@92.17.46.220] has joined #go-nuts
10:48 -!- visof [~visof@unaffiliated/visof] has quit [Ping timeout: 276 seconds]
10:51 -!- Fish- [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has joined #go-nuts
10:56 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
10:57 -!- edsrzf [~kelvan@122-61-221-144.jetstream.xtra.co.nz] has quit [Ping
timeout: 248 seconds]
11:02 -!- visof [~visof@unaffiliated/visof] has quit [Ping timeout: 264 seconds]
11:03 -!- bawr [~bawr@unaffiliated/mrfawkes] has joined #go-nuts
11:06 -!- bawr [~bawr@unaffiliated/mrfawkes] has left #go-nuts []
11:10 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
11:22 -!- bjarneh [~bjarneh@190.84-48-119.nextgentel.com] has quit [Ping timeout:
276 seconds]
11:33 -!- bjarneh [~bjarneh@190.84-48-119.nextgentel.com] has joined #go-nuts
11:35 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has quit [Ping timeout:
252 seconds]
11:36 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has joined #go-nuts
11:38 -!- visof [~visof@unaffiliated/visof] has quit [Ping timeout: 252 seconds]
11:39 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has quit [Read error:
Operation timed out]
11:40 -!- Project_2501 [~Marvin@82.84.69.89] has joined #go-nuts
11:43 -!- Project-2501 [~Marvin@82.84.98.115] has quit [Ping timeout: 276 seconds]
11:55 -!- femtoo [~femto@95-89-198-8-dynip.superkabel.de] has joined #go-nuts
11:57 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has joined #go-nuts
12:05 -!- wrtp [~rog@92.17.46.220] has quit [Quit: wrtp]
12:13 -!- hlorofils [~hlorofils@87.110.228.45] has joined #go-nuts
12:18 -!- hlorofils [~hlorofils@87.110.228.45] has quit []
12:18 < napsy> Hello.  Is there a way to cinvert an int to []byte?  I have
to write the integer into an array as raw data not the actual numbers it
represents
12:20 -!- photron [~photron@port-92-201-10-205.dynamic.qsc.de] has quit [Ping
timeout: 248 seconds]
12:22 -!- ildorn [~ildorn@p5B2FD51D.dip.t-dialin.net] has joined #go-nuts
12:22 -!- ildorn [~ildorn@p5B2FD51D.dip.t-dialin.net] has quit [Client Quit]
12:22 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
12:26 -!- cenuij [~cenuij@78.112.41.178] has joined #go-nuts
12:26 -!- cenuij [~cenuij@78.112.41.178] has quit [Changing host]
12:26 -!- cenuij [~cenuij@base/student/cenuij] has joined #go-nuts
12:29 < napsy> or can I somehow copy the contents in unsafe.Pointer to,
let's say, []byte?
12:33 < Namegduf> You can cast an unsafe.Pointer to a pointer to a byte
array the same size of the data.
12:33 < Namegduf> This is unsafe, of course.
12:33 < Namegduf> You can then slice that array all you like.
12:34 < napsy> ok, let's try
12:34 < Namegduf> I feel obliged to mention encoding/binary as an
alternative for cases where you're trying to use it for sending the data to
something.
12:34 < Namegduf> It does the job for you, but is portable and safe.
12:35 < Namegduf> No issues with endianness or padding.
12:35 < napsy> well, I'm trying to port a binary protocol to go and it's
very strict about packets
12:35 < Namegduf> Okay, fair enough.
12:36 < Namegduf> I think the idiomatic way to do it, then, would be to
construct it using a []byte, manually setting each byte as desired.
12:36 < Namegduf> Rather than using unsafe.
12:36 < Namegduf> Because the binary protocol will have a specific byte
order it expects.
12:36 < Namegduf> And if structs are sent, specific padding or lack thereof.
12:37 -!- karpar [~karpar@112.96.254.20] has joined #go-nuts
12:37 < Namegduf> And Go does not guarantee that the memory representation
of things will match it.
12:38 < napsy> so, if I have an int, I have to package it to a larger
[]byte, would that go without unsafe?
12:38 < aiju> yes
12:38 < aiju> napsy: encoding/binary
12:39 < napsy> does encoding/binary add any other information besides the
data?
12:39 < aiju> no
12:39 < aiju> it just concatenates all struct fields
12:39 < napsy> hm that sounds interesting
12:40 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
12:41 < Namegduf> Yeah, if all you're sending is integers, nothing bigger
12:41 < Namegduf> Then you can match a binary format using encoding/binary
of the right endianness.
12:42 < napsy> well simetimes integers, then strings, it could happen I send
really big stuff ie.  > 3000 bytes
12:42 < Namegduf> Strings will need to be sent the way it expects, which
will probably involve copying them to a []byte slice, sticking a NUL on the end,
and writing that.
12:43 < Namegduf> (If it uses a C-like thing for sending them)
12:43 < napsy> ok
12:43 < aiju> 3000 bytes is "really big"?  heh
12:45 < napsy> well, no :)
12:53 -!- karpar [~karpar@112.96.254.20] has quit [Ping timeout: 240 seconds]
12:55 < napsy> data := [unsafe.Sizeof(t)]byte(p)
12:55 < napsy> p is unsafe.Pinter
12:55 < napsy> but it doesn't work
12:57 < Namegduf> You can't create an array of size defined at runtime.
12:58 < Namegduf> Array size is part of the type.
12:58 < napsy> hum still doesn't work
12:59 < ww> this reminds me of the get-at-const-char* discussion on the list
a few days ago
12:59 < aiju> napsy: why not just use encoding/binary
13:00 < napsy> I probably will but I'm still interested how unsafe.Pointer
works
13:00 < aiju> terreo unsafe et dona ferrentem
13:00 < aiju> napsy: you can create a slice using reflect
13:01 < aiju> slh := (*reflect.SliceHeade)(unsafe.Pointer(&slice))
13:01 < aiju> slh.Data = uintptr(unsafe.Pointer(&data))
13:01 < aiju> slh.Len, slh.Cap = len, len
13:01 < ww> unless making c language bindings, probably best to stay away
from unsafe
13:01 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
13:01 < aiju> ww: or when dealing with low level stuff, exactly
13:07 < ww> and/or when needing to punch through over-eager type safety
13:08 < ww> s := C.GoString((*C.char)(unsafe.Pointer(ucharp)))
13:09 < ww> aka, s = (char *)ucharp;
13:10 < napsy> hm, someone should covert this in a document
13:10 < ww> because of a c library that was giving unsigned char * for
strings...
13:12 < ww> napsy, good idea...  maybe i'll try documenting some of my
experiences making c bindings...
13:12 < napsy> that would be really great
13:29 -!- wrtp [~rog@92.17.46.220] has joined #go-nuts
13:30 -!- DerHorst [~Horst@e176103212.adsl.alicedsl.de] has joined #go-nuts
13:32 -!- skejoe [~skejoe@188.114.142.162] has joined #go-nuts
13:39 -!- TheMue [~TheMue@p5DDF64B6.dip.t-dialin.net] has joined #go-nuts
13:50 -!- bjarneh [~bjarneh@190.84-48-119.nextgentel.com] has quit [Quit: leaving]
13:53 -!- damag [~damag@2a01:e35:8b04:de80:21d:9ff:fe88:4097] has joined #go-nuts
13:55 -!- alkavan_ [~alkavan@IGLD-84-228-193-27.inter.net.il] has joined #go-nuts
13:55 < steven> so guys, guess what.
13:55 < damag> Hi, does Go require Perl and CGI.pm to build now?  Just tried
to build it and it gave a bunch of errors after the "gopack grc _test/http/cgi.a
_gotest_.6" line.
13:55 < steven> i have a weird issue, where when i sent to a channel, and
receive from that channel in select, my program hangs
13:56 < damag> "Can't locate CGI.pm in @INC"
13:56 < steven> ooh i see what the problem is..
13:57 < steven> i didnt sent to the chan via a goroutine
13:57 -!- skejoe [~skejoe@188.114.142.162] has quit [Quit: Lost terminal]
13:57 < steven> why is it that we need to sent to chans via goroutines?  is
sending to a chan a blocking call?
13:57 -!- jumzi [~none@c-89-233-234-125.cust.bredband2.com] has joined #go-nuts
13:57 < aiju> steven: yes, unless you use select
13:58 < steven> but im using select.
13:59 < steven> heres what i have, https://gist.github.com/856170 ..  look
at lines 137, 124, and 99
14:00 < steven> whats happening is im basically sending to a chan within a
case statement of a select statement (technically via a callback), and receiving
on that same chan in that same select statement in another case statement
14:01 < steven> so im guessing the best real solution here, is to call all
my callbacks via "go callback()" intead of just "callback()", inside my select
statement..
14:01 < steven> (is what i have a multiplexer, btw?)
14:01 < aiju> it blocks unless you have a default: statement
14:03 -!- mbernstein [~michael@cpe-70-113-7-72.austin.res.rr.com] has joined
#go-nuts
14:03 < steven> oh.  so which is a better solution, hvaing a default
statement or calling my callbacks as goroutines?
14:04 < aiju> i don't quite now what you try to do
14:04 < aiju> +k
14:04 < steven> oh, obviously the goroutines, because otherwise im *forced*
to have some operation in the default case
14:04 -!- damag [~damag@2a01:e35:8b04:de80:21d:9ff:fe88:4097] has quit [Quit:
Leaving]
14:04 < aiju> you shouldn't loop over a non-blocking select
14:04 < aiju> CPU usage would skyrocket
14:04 < steven> oh right.
14:05 < steven> so, heres my very first Go program since understanding how
Go works :) -- https://gist.github.com/856170
14:05 < steven> its a dumb IRC client, it displays every line from the
server raw, and sends every line you type to the server raw :D
14:06 < aiju> why do you use channels for signal handling
14:06 < steven> do you mean to handle getting data from one of the input
streams?
14:07 < steven> at the time, it seemed the cleanest way to separate the
responsibilities..  how would you rather do it?
14:07 < aiju> oh wait this is a Go "feature"
14:07 < exch_> ya
14:07 < aiju> blah
14:07 < aiju> terrible
14:07 < steven> aiju: how would you do it instead?
14:07 < steven> exch_: would you do it this way too?
14:07 < aiju> steven: not something with your program
14:07 < aiju> rather a Go thing
14:07 < steven> perhaps i shouldnt be taking Go advice from someone who
seems to dislike Go ;)
14:07 < aiju> steven: i love Go
14:08 < skelterjohn> morning
14:08 < skelterjohn> whoah, still at it, steve?
14:08 < steven> oh cool
14:08 < aiju> steven: just because i question some design decision doesn't
change anything about it
14:08 < steven> nah i just woke up skelterjohn.
14:08 < steven> took like a 6 hour nap
14:08 < steven> check it out skelterjohn, im slightly proud of what ive come
up with so far :) https://gist.github.com/856170
14:09 < aiju> there are only two reasonable possibilities how to handle a
signal
14:09 < aiju> ignore it or die
14:09 < exch_> steven: your code basically does the same as my irc bot.  My
bot simply has the logic ordered a bit differently but the idea is the same.
14:09 < exch_> it works
14:10 < aiju> i should write an angry post about this on the mailing list
14:10 < skelterjohn> cool - too much code for me to understand 3 minutes
after i get up
14:10 < aiju> what?  you don't dream in Go yet?
14:10 < skelterjohn> unfortunately this past night i was dreaming of css :\
14:10 < aiju> oh nightmares
14:10 < skelterjohn> yes
14:11 < skelterjohn> my stupid layout isn't working right
14:11 < skelterjohn> and it's because i don't understand css
14:11 < skelterjohn> with go, everything is peaches
14:11 < skelterjohn> if that's a saying
14:11 < aiju> hahaha
14:11 < aiju> i can't do web design at all
14:12 < aiju> i don't have any layout or something in my head
14:12 -!- foocraft [~dsc@78.100.210.180] has quit [Ping timeout: 252 seconds]
14:13 -!- vexd [~vex@91-65-134-239-dynip.superkabel.de] has joined #go-nuts
14:14 < exch_> layout is overrated anyway.  If it's subtle, elegant and
above all, functional, you have a winner as far as I'm concerned
14:14 < aiju> yeah, pretty much same for me
14:14 < skelterjohn> i just want shit to go where i put it
14:14 < aiju> i just use werc for all my websites
14:15 < exch_> I subscribe to the notion of Less is More.  Al the fancy
graphics and effects and other little annoying tidbits people cram into their
sites just distract from what is important
14:15 < aiju> no need to write HTML, CSS, XML or w/e
14:15 < aiju> just fucking plain text
14:15 -!- drhodes [~none@drhodes.xen.prgmr.com] has quit [Quit: Reconnecting]
14:15 -!- drhodes [~none@drhodes.xen.prgmr.com] has joined #go-nuts
14:16 -!- mattn_jp [~mattn@s60.BMT-e1.vectant.ne.jp] has joined #go-nuts
14:17 < wrtp> steven: instant reaction seeing the first function there: you
should never check for closed on a channel you're sending to
14:17 < wrtp> (you won't be able to soon anyway)
14:20 < steven> wrtp: but that throws a runtime panic
14:22 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Ping
timeout: 255 seconds]
14:22 < steven> doesnt it?
14:22 < steven> maybe it doesnt.
14:22 < wrtp> what throws a runtime panic?
14:22 < steven> sending to a closed channel
14:23 < wrtp> yes, but you can't avoid that by checking for closed
14:23 < wrtp> the sender should be the one closing the channel.
14:23 < aiju> else you run into all kind of race conditions
14:24 < steven> wrtp: so i shouldnt call close() inside my goroutine?  ok,
so how do i tell it to quit from within a goroutine?  maybe send to quitChan?
14:24 < wrtp> yes, you could do that
14:24 < wrtp> i don't really see why you bother cleaning up at all.
14:24 < wrtp> just exit and all will be fine
14:25 < steven> because it might not be an os.Exit
14:25 < wrtp> what?
14:25 < steven> it might be, "ok this bot is dead, with all its chans, but
im creating a new bot now"
14:25 < steven> ie, program still running, but id want to kill all the
remaining goroutines of the current bot thats dying
14:25 < wrtp> all goroutines die when the program exits
14:26 < wrtp> oh i see, so this would be part of a bot library
14:26 < steven> but im saying the program might not be exiting at the point
this bot is being cleaned up..  it may just be preparing for another bot to come
to life
14:26 < steven> (coincidentally, right now its just going to exit as soon as
the bot dies)
14:26 < wrtp> well, you definitely don't want to have the library handling
SIGINT then
14:26 < steven> point is, i dont want to rely on things just "automatically
cleaning up"
14:27 < steven> wrtp: true.  how else could that be structured?  can you
have two selects running simtultaneously?
14:27 < wrtp> yes
14:27 < steven> with the way select works, i dont thnk its possible to "pass
in" a case via an anon func or something
14:27 < steven> hmm
14:27 < steven> but they're blocking selects, arent they?
14:28 < steven> unless i ran one inside a goroutine...
14:28 < steven> hmm this is interesting, i like your idea :)
14:29 < wrtp> another little comment: just use net.Dial, don't bother with
ResolveTCPAddr and DialTCP
14:29 < ww> do we have sctp support?
14:29 < steven> oh yeah?  you've found that to be reliable?
14:30 < wrtp> it's just easier, and makes it trivial to adapt your program
to new transports if you want to
14:31 < wrtp> your program becomes 5 lines shorter and more general into the
bargain.  :-)
14:32 < wrtp> also, you probably don't want your entire program to die if
you get a network error.
14:32 < wrtp> i think the way i'd handle termination is by making Quit close
bot.conn
14:32 < femtoo> func a() (int, int) { return 1, 2 }
14:32 < femtoo> func main() { var x, y int; x, y = a() } // works
14:32 < femtoo> func main() { var x, y int; x, y += a() } // compiler error
14:33 < aiju> i don't think the latter is allowed
14:33 < wrtp> then the Read in getData will terminate with an error, and it
can close ch
14:33 < femtoo> aiju why not?
14:33 < skelterjohn> because.
14:34 < femtoo> lol but it would just make sense
14:34 < aiju> the spec says so
14:34 -!- sacho [~sacho@87-126-37-121.btc-net.bg] has quit [Read error: Connection
reset by peer]
14:34 < aiju> "In assignment operations [e.g.  +=], both the left- and
right-hand expression list must contain exactly one single-valued expression."
14:34 < steven> man i really like goroutines :)
14:35 < wrtp> almost all the goodness is in the channels IMHO
14:35 < femtoo> aiju, ok ty
14:35 -!- stalled [~stalled@unaffiliated/stalled] has quit [Ping timeout: 250
seconds]
14:36 < ww> with chammels just remember you almost always want to send
pointer or reference types or simple things like integers
14:36 < wrtp> ww: i dunno, i quite often send moderately big structs
14:37 < steven> is it a bad practice, though, to use channels as a transport
for data received via a "get data from input stream when its ready" function
(goroutine)?
14:37 < wrtp> it's quite efficient, and it saves bothering about side
effects
14:37 < ww> sending a struct directly means a copy i think
14:37 < aiju> steven: no
14:37 < wrtp> ww: a copy is cheap
14:37 < wrtp> ww: cheaper than a heap alloc
14:37 < aiju> wrtp: not on ww's VAX 11/780
14:37 < skelterjohn> lol
14:38 < ww> :>
14:38 < wrtp> steven: that's just what channels are for
14:38 < aiju> Pike wrote a whole window manager using something like
channels in C
14:38 < steven> oh.  awesome.
14:38 < wrtp> your program isn't bad at all - as always, getting going is
fine, but closing down can be awkward
14:39 < wrtp> aiju: channels work well for window manager type stuff
14:39 < wrtp> i wrote one too; similar approach
14:42 < steven> why is it suddenly that when i took wrtp'ssuggestion of
changing my bot.conn from being *net.TCPConn to net.Conn, suddenly i cant assign
it via "bot.conn, e := net.Dial(...)" , getting the error "non-name bot.conn on
left side of :=" ?
14:43 < steven> is it because its no longer a pointer type?
14:43 < aiju> you can't have struct members on the left side of :=
14:43 < steven> oh.  but it worked before when it was type *net.TCPConn, as
opposed to net.Conn
14:44 < aiju> really?  wtf
14:44 < skelterjohn> if e was undeclared before that, it would pretend it's
an "=" for the other LHS
14:44 < skelterjohn> i th ink
14:44 < wrtp> steven: no it didn't :-)
14:44 < wrtp> before, you had bot.con, e = net.TCPDial
14:44 < wrtp> note = not :=
14:45 < wrtp> your best bet is to return an error from connect
14:45 < skelterjohn> anyone want to help me with an html/css issue?
14:45 < wrtp> lol
14:45 < wrtp> skelterjohn: no!
14:45 < skelterjohn> :'(
14:45 < wrtp> :-)
14:45 < skelterjohn> it's for a go program
14:45 < skelterjohn> it's my GUI
14:46 -!- hcatlin [~hcatlin@host86-145-112-33.range86-145.btcentralplus.com] has
joined #go-nuts
14:46 -!- hcatlin [~hcatlin@host86-145-112-33.range86-145.btcentralplus.com] has
quit [Changing host]
14:46 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined
#go-nuts
14:46 < skelterjohn> http://jsfiddle.net/6FeeY/5/ <- purple bit is
supposed to extend to the right edge, filling in the blue bit
14:46 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Client
Quit]
14:46 < wrtp> steven: if you had func (bot *IRCBot) connect() (err os.Error)
{
14:46 < wrtp> then you could do bot.conn, e = ....
14:46 < wrtp> skelterjohn: go on then, what's the issue?
14:47 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
14:47 < skelterjohn> it's not doing what i said
14:47 < steven> wrtp: ooooh
14:47 < skelterjohn> purple bit is only big enough to contain the text
14:47 < skelterjohn> oh and the green bit is supposed to be exactly 200px
wide, but it also is just big enough to hold the text
14:48 < wrtp> steven: you'll want Run to return an error anyway
14:48 < ww> skelterjohn the firefox web developer addon might help...
14:48 < skelterjohn> i feel like this is simple enough that i should be able
to do it by hand
14:48 < skelterjohn> or else i won't actually know what's going on
14:49 * ww knows < 0 about these things...
14:49 < wrtp> i wrote a css parser once
14:49 < wrtp> but i never wrote any css :-)
14:49 < ww> the addon just lets you look at what is going on and tweak it,
it won't write anything for you
14:49 < wrtp> skelterjohn: so, sorry, i've no idea
14:49 < ww> 's a debugger not an editor...
14:51 < wrtp> that jsfiddle thing looks quite useful
14:52 < wrtp> i keep on telling myself i should learn a bit more html shite
14:54 < ww> best left to those who enjoy spaghetti imo
14:56 < wrtp> apart from anything it might a useful way to make a few quid
now and then
14:56 -!- rlab [~Miranda@91.200.158.34] has quit [Ping timeout: 252 seconds]
14:56 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
14:57 < skelterjohn> i keep feeling like there is no way the css i'm writing
could mean anything other than what i want it to mean
14:57 < skelterjohn> and it just does something else
14:59 < jumzi> That's web development for ya!
14:59 < skelterjohn> go eat an orange!
14:59 * aiju is currently trying to read FAT12
15:00 < aiju> no source fucking explains what a cluster number is
15:00 -!- alkavan_ [~alkavan@IGLD-84-228-193-27.inter.net.il] has quit [Read
error: Connection reset by peer]
15:00 < steven> does it make sense to check, from within a goroutine, if its
channel is closed right after sending to it, to see if you need to break the
infinite loop and exit the goroutine?
15:00 < steven> ie, what im doing at line 18 in
https://gist.github.com/856170
15:00 -!- alkavan_ [~alkavan@IGLD-84-228-193-27.inter.net.il] has joined #go-nuts
15:00 < wrtp> steven: no
15:01 < steven> (which is updated now to take into account wrtp's idea about
closing channels in one spot only)
15:01 < steven> oh.  well how would you make sure that the goroutine dies
when appropriate?
15:01 < skelterjohn> only close it from one point
15:01 < skelterjohn> you have complete control over whether it gets closed
or not - if you haven't done it, it hasn't happened
15:01 < skelterjohn> no need to check
15:02 < wrtp> steven: when you get EOF, just close(ch)
15:02 < skelterjohn> it's not like network connections that can just go bad
15:02 < wrtp> don't bother sending on quitChan - closing ch should be good
enough
15:02 < ww> and if you want it to die in the middle because the reciever is
tired of receiving?
15:03 < wrtp> then you make the sender select on quitChan while trying to
send
15:03 < ww> so a second channel, nonblocking...
15:03 < ww> right
15:03 < wrtp> not nonblocking
15:04 < wrtp> one useful technique for sending shutdown notifications to
those that might not be ready to receive them, is to have a channel that is never
sent on, only closed.
15:04 < wrtp> so instead of sending a value to quitChan you just close it
15:04 < wrtp> then any readers of quitChan will receive a quit notification
15:04 < wrtp> no matter how many there are
15:04 < ww> wrtp right...  although maybe an acutal semaphore or something
15:05 < wrtp> why?
15:05 < wrtp> the nice thing about channels is you can select on them
15:05 < wrtp> you can't select on semaphores
15:05 < ww> because you don't need all the other channel machinery for that
15:05 < steven> wrtp: problem is, i have 2 goroutines open, and one of them
may get an EOF while the other is still alive and well
15:05 < wrtp> but a goroutine might want to wait to receive something on a
channel *or* the quit notification
15:06 < steven> so i need to kill the other one somehow.
15:06 < wrtp> steven: that's fine
15:06 < wrtp> actually, you've got 3 goroutines
15:06 < steven> and only thing i can think that does that is sending to (or
better yet, closing) a channel that it has access to
15:06 < wrtp> you've got 2 readers
15:06 < wrtp> and one central goroutine
15:06 < steven> yes, one of them is a signal handler.
15:06 < wrtp> the coordinator
15:06 < steven> oh.
15:07 < wrtp> oh, i didn't see the signal handler
15:07 < wrtp> ignore that for the time being
15:07 < steven> you may want to refresh :)
15:07 < steven> https://gist.github.com/856170
15:07 < steven> that could be the problem
15:07 < ww> wrtp i don't dispute that it is reasonable and clean to use a
channel like that...  just thinking of other ways
15:07 -!- stalled [~stalled@unaffiliated/stalled] has quit [Ping timeout: 250
seconds]
15:08 < piranha> hm, go compiler complains on string "^\." - says "unknown
escape sequence: ." - what to do?  I want to compile regexp, which matches dots on
start of string
15:08 < skelterjohn> \\
15:08 < steven> piranha: "^\\."
15:08 < piranha> ah, thank you
15:08 < skelterjohn> or put it in backticks
15:08 < skelterjohn> for raw string, no escapes
15:08 < skelterjohn> `^\.`
15:08 < wrtp> ww: there are other ways, but they all use channels :-)
15:08 < piranha> oh, that's better
15:08 < piranha> skelterjohn: thanks :)
15:09 < wrtp> steven: we can ignore the signal handler because it doesn't
interact with the other goroutines
15:09 < wrtp> steven: essentially there are three ways the connection to go
down
15:09 < steven> (right)
15:09 < wrtp> steven: 1) user quits, so you get EOF on stdin
15:10 < wrtp> 2) connection goes down, so you get EOF (or error) on bot.conn
15:10 -!- TheSeeker [~n@99-153-250-110.lightspeed.irvnca.sbcglobal.net] has quit
[]
15:10 < wrtp> 3) the app that's using the IRCBot decides that it wants to
tear down the connection by calling bot.Quit
15:11 < wrtp> if any of those three happen, you want the other two to go
down
15:11 -!- ronnyy [~quassel@p4FF1C202.dip0.t-ipconnect.de] has quit [Remote host
closed the connection]
15:11 < wrtp> the coordinator goroutine can organise for that to happen
15:12 -!- dario [~dario@domina.zerties.org] has quit [Quit: leaving]
15:13 < steven> right.
15:13 < piranha> hm, are there macros?  If I want to get a list of compiled
regular expressions, what's the right thing to do?  Right now I just do it in my
main() func, but it seems a bit ugly to me...  (I'm quite new to static/compiled
languages, so I have quite a few dumb questions)
15:13 < steven> wrtp: in all 3 cases, i have it sending quitChan <- true
15:13 < piranha> I mean list of those regexps as a global variable
15:13 < wrtp> piranha: no macros
15:14 < steven> and there's only one receiver of quitChan which is
responsible for shutting everything down.
15:14 < piranha> wrtp: then..  is compiling them in main() right thing to
do?
15:14 < wrtp> steven: i don't think you want it to send on quitChan ever...
15:14 < wrtp> piranha: you could do them at init time
15:14 < steven> oh?  why not?
15:14 < ww> steven i think close(quitChan)
15:14 < skelterjohn> piranha: var re = regexp.MustCompile(...)
15:14 < wrtp> ww: that's part of the solution
15:14 < steven> come to think of it, 3 goroutines at the same time could end
up writing to quitChan simultaneously
15:14 < ww> and then check closed on the receiver...
15:14 < skelterjohn> just put that in global namespace
15:14 < piranha> skelterjohn: so just by hands?
15:15 < piranha> yep, but I have quite a few of them
15:15 < steven> ww: then 3 goroutines could simultaneously try to
close(quitChan), right?  wouldnt that be really bad?
15:15 < skelterjohn> well, you have to list them *somehow*...
15:15 < ww> but don't you have to read from it before closed() will work?
15:15 < skelterjohn> can load them in from a file?
15:15 < wrtp> steven: the only thing that should close quitChan is the Quit
method
15:15 < steven> oh maybe im confused about how goroutines work..  maybe they
dont actually run in parallel
15:15 < piranha> skelterjohn: well, they are now as list of strings and then
on start main() compiles them to regular expressions
15:15 < steven> so maybe all 3 goroutines cannot close(quitChan) at the
exact same time..
15:15 < skelterjohn> oh i see
15:16 < skelterjohn> piranha: just do it in init() instead if you need logic
to compile them
15:16 < wrtp> steven: you can't close a channel more than once or you'll get
a panic
15:16 < piranha> I would do something like map(re.compile, ["a", "b"]) in
python
15:16 < ww> steven assume they do run in parallel even if they may or may
not
15:16 < piranha> skelterjohn: init() is a magic name like main()?
15:16 < skelterjohn> yes
15:16 < piranha> cool!
15:16 < piranha> found in docs :)
15:16 < steven> ok.
15:16 < aiju> i think init() is really magic
15:16 < steven> so yeah, your idea ww would cause a runtime panic.
15:17 < steven> its safer to send 3 times to quitChan and receive once, than
to close it 3 times
15:17 < ww> sure.
15:17 < steven> although, i think if all 3 goroutines tried to send to (its
unbuffered), they would all block..  right?
15:18 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
15:18 < ww> you can make nb send
15:18 < ww> quitChan, ok <- true
15:18 < ww> i believe
15:18 < steven> (actually, is it unbuffered when i create it like this?
"quitchan chan bool" ..  "quitchan := make(quitchan)"
15:19 < wrtp> piranha: http://pastebin.com/6NmCb9jg
15:19 < piranha> hm, can't understand what's the difference between main()
and init()...  it's like init just is executed before main?  should I parse my
command line in init or in main?
15:19 < femtoo> is there a way to convert a boolean to an integral type
15:19 < wrtp> ww: you can't do that any more
15:19 < femtoo> so true gets 1
15:19 < femtoo> and false 0
15:19 < steven> piranha: init is more for packages i think
15:19 < wrtp> but you don't want to do that anyway
15:19 < piranha> wrtp: hm, sure :)
15:19 < piranha> steven: ah, ok then
15:20 < ww> piranha init is often used by modules for global initialisation
15:20 < ww> wrtp oh no?
15:20 < wrtp> piranha: that works for global variables too
15:20 < piranha> aha
15:20 < ww> i think i got that from the video on the site
15:21 < wrtp> ww: yeah, it's changed recently.  you can still do non
blocking sends, but you have to use a select statement
15:21 < wrtp> with a default clause
15:21 < ww> aha i see
15:21 < piranha> btw, another thing I can't understand - I use os.Walk,
which wants a Visitor.  Can I implement Visitor methods (VisitDir/VisitFile) in my
function or they should be defined in global namespace?  If so, is parametrizing
them through using global vars ok?
15:24 -!- TheSeeker [~n@99-153-250-110.lightspeed.irvnca.sbcglobal.net] has joined
#go-nuts
15:25 < wrtp> piranha: define VisitDir and VisitFile on a type of your own,
then invoke Walk on an instance of that type
15:26 -!- visof [~visof@unaffiliated/visof] has quit [Ping timeout: 260 seconds]
15:26 < piranha> wrtp: that's what I'm doing, but they are defined in global
namespace (on same level as my function), so I can't parametrize them other than
set some global variable
15:26 < wrtp> piranha: of course you can
15:26 < wrtp> just put the data inside the type
15:27 < piranha> type *Visitor struct { VisitDir ....  }
15:27 < piranha> like that?
15:27 < wrtp> no
15:27 < aiju> that's not even valid
15:27 < piranha> aiju: I can imagine
15:27 < piranha> wrtp: ah!
15:27 < wrtp> type myVisitor struct { foo myParameters }
15:27 < piranha> data!  :)
15:27 < piranha> sure :)
15:27 < wrtp> func (m *myVisitor) VisitDir(...)
15:30 < piranha> huh, that's much better :)
15:32 < wrtp> steven: i'm just doing a version of your program to
demonstrate what i was talking about
15:32 < wrtp> gimme a couple of minutes
15:32 -!- Project-2501 [~Marvin@82.84.91.33] has joined #go-nuts
15:35 -!- perdix [~mkhl@sxemacs/devel/perdix] has quit [Remote host closed the
connection]
15:35 -!- Project_2501 [~Marvin@82.84.69.89] has quit [Ping timeout: 260 seconds]
15:37 -!- fenicks [~fenicks@log77-3-82-243-254-112.fbx.proxad.net] has joined
#go-nuts
15:48 < steven> my goroutine handling is buggy.  sonofa.
15:48 -!- shvntr [~shvntr@113.84.144.217] has quit [Ping timeout: 255 seconds]
15:48 < steven> im trying to write a really simple case so i can learn how
to do it right, and its not simple at all.  but i cant get it any simpler.
15:54 < steven> im so confused.
15:54 < steven> this is the confusing horrible mess i have:
https://gist.github.com/856170
16:00 < steven> maybe what i need is a lock around quitChan
16:03 -!- cco3 [~conley@c-69-181-140-72.hsd1.ca.comcast.net] has joined #go-nuts
16:04 < steven> even when i check to make sure the chans not closed when i
sent to it, it still has that exact problem.
16:04 < steven> ie, send on closed channel
16:06 < wrtp> steven: here's something towards what i had in mind:
http://pastebin.com/GDtjSQ5g
16:06 < wrtp> i didn't actually get it working, but i hope it demonstrates
the idea
16:07 < steven> does the ! operator work the same way as in C?
16:07 < steven> ie, is this doing what i think it is?  "if !closed(ch) { ch
<- data }"
16:07 < skelterjohn> yes
16:08 < wrtp> yes, except it only works on booleans
16:08 < wrtp> steven: yes, but that's a bad idea!
16:08 < wrtp> NEVER CHECK CLOSED IN A SENDING GOROUTINE!
16:08 < steven> then im lost as to why im still panicking
16:08 < steven> oh.
16:08 < steven> what should i do instead?
16:08 < wrtp> have a look at the code i just pasted
16:09 < wrtp> it restructures your code in a way that makes it unnecessary
16:09 < steven> ok i will
16:09 < steven> btw this is what i have so far:
https://gist.github.com/856170
16:09 < steven> ill look at what you have.  thanks.
16:10 < wrtp> i think it should work in principle, but i haven't had time to
test it, and i really need to go!
16:10 < wrtp> i'll be back on monday
16:10 < wrtp> ttfn
16:10 -!- wrtp [~rog@92.17.46.220] has quit [Quit: wrtp]
16:17 < steven> thanks.
16:22 -!- ymasory [~ymasory@c-76-99-55-224.hsd1.pa.comcast.net] has joined
#go-nuts
16:24 -!- cco3 [~conley@c-69-181-140-72.hsd1.ca.comcast.net] has quit [Ping
timeout: 276 seconds]
16:25 < ww> steven: http://golang.org/pkg/sync/#Cond
16:25 -!- pr [phil@unaffiliated/pr] has left #go-nuts []
16:25 < ww> maybe good for signalling time-to-exit
16:26 -!- sauerbraten [~sauerbrat@p508CAE07.dip.t-dialin.net] has joined #go-nuts
16:37 -!- visof [~visof@41.238.234.59] has joined #go-nuts
16:37 -!- visof [~visof@41.238.234.59] has quit [Changing host]
16:37 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
16:44 -!- jumzi [~none@c-89-233-234-125.cust.bredband2.com] has quit [Remote host
closed the connection]
16:46 -!- jokoon [~zonax@feu30-1-82-242-58-229.fbx.proxad.net] has joined #go-nuts
16:58 -!- cco3 [~conley@c-69-181-140-72.hsd1.ca.comcast.net] has joined #go-nuts
17:03 -!- cco3 [~conley@c-69-181-140-72.hsd1.ca.comcast.net] has quit [Ping
timeout: 260 seconds]
17:04 -!- photron [~photron@port-92-201-10-205.dynamic.qsc.de] has joined #go-nuts
17:07 -!- visof [~visof@unaffiliated/visof] has quit [Remote host closed the
connection]
17:14 -!- jumzi [~none@c-89-233-234-125.cust.bredband2.com] has joined #go-nuts
17:21 -!- cco3 [~conley@c-69-181-140-72.hsd1.ca.comcast.net] has joined #go-nuts
17:26 -!- tvw [~tv@e176001205.adsl.alicedsl.de] has joined #go-nuts
17:29 -!- TheMue [~TheMue@p5DDF64B6.dip.t-dialin.net] has quit [Quit: TheMue]
17:30 -!- cco3 [~conley@c-69-181-140-72.hsd1.ca.comcast.net] has quit [Ping
timeout: 252 seconds]
17:38 -!- nettok [~quassel@200.119.175.24] has joined #go-nuts
17:44 -!- visof [~visof@41.238.234.59] has joined #go-nuts
17:44 -!- visof [~visof@41.238.234.59] has quit [Changing host]
17:44 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
18:00 -!- crawshaw [~crawshaw@216.239.45.130] has joined #go-nuts
18:01 < crawshaw> hello
18:01 < crawshaw> newbie question
18:01 < crawshaw> hg pull && hg update release && ./all.bash
18:01 < crawshaw> ...
18:01 < crawshaw> --- FAIL: net.TestMulticastJoinAndLeave (0.0 seconds)
18:01 < crawshaw> joingroup udp 224.0.0.254: setsockopt: can't assign
requested address
18:01 < crawshaw> OS X 10.6.5
18:01 < crawshaw> any ideas?
18:03 < crawshaw> I'm tempted to blame the vpn
18:07 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
18:07 -!- unhygienix [~unhygieni@host86-184-226-75.range86-184.btcentralplus.com]
has joined #go-nuts
18:08 < skelterjohn> you can disable net tests by setting
DISABLE_NET_TESTS=1
18:09 < crawshaw> cheers, trying it now
18:09 -!- jokoon [~zonax@feu30-1-82-242-58-229.fbx.proxad.net] has quit [Quit:
Leaving]
18:10 < skelterjohn> it's a common problem :)
18:10 < crawshaw> hmm
18:10 < crawshaw> then perhaps http://golang.org/doc/install.html should be
updated
18:16 < crawshaw> excellent, that worked
18:16 < crawshaw> thanks!
18:19 -!- boscop [~boscop@f050133076.adsl.alicedsl.de] has quit [Ping timeout: 255
seconds]
18:19 -!- unhygienix [~unhygieni@host86-184-226-75.range86-184.btcentralplus.com]
has left #go-nuts []
18:25 -!- crawshaw [~crawshaw@216.239.45.130] has quit [Ping timeout: 276 seconds]
18:37 -!- crawshaw [~crawshaw@c-76-103-252-240.hsd1.ca.comcast.net] has joined
#go-nuts
18:38 -!- fenicks [~fenicks@log77-3-82-243-254-112.fbx.proxad.net] has quit
[Remote host closed the connection]
18:38 -!- fenicks [~fenicks@log77-3-82-243-254-112.fbx.proxad.net] has joined
#go-nuts
18:40 -!- crawshaw [~crawshaw@c-76-103-252-240.hsd1.ca.comcast.net] has quit
[Remote host closed the connection]
18:40 -!- crawshaw [~crawshaw@216.239.45.130] has joined #go-nuts
18:43 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Ping timeout: 248 seconds]
18:49 -!- nictuku [~nictuku@cetico.org] has quit [Changing host]
18:49 -!- nictuku [~nictuku@unaffiliated/nictuku] has joined #go-nuts
18:50 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has quit [Read error:
Operation timed out]
18:50 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
18:51 -!- perdix [~mkhl@sxemacs/devel/perdix] has joined #go-nuts
18:51 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has joined #go-nuts
18:54 -!- edsrzf [~kelvan@122-61-221-144.jetstream.xtra.co.nz] has joined #go-nuts
18:56 -!- crawshaw [~crawshaw@216.239.45.130] has quit [Ping timeout: 248 seconds]
18:59 -!- lmoura [~lauromour@187.113.67.22] has quit [Quit: Leaving]
19:00 -!- boscop [~boscop@f050135026.adsl.alicedsl.de] has joined #go-nuts
19:10 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.4]
19:10 -!- PortatoreSanoDiI [~Marvin@82.84.99.90] has joined #go-nuts
19:11 < |Craig|> my tls handshake is not returning, and I get no errors.
What could cause this?
19:14 -!- Project-2501 [~Marvin@82.84.91.33] has quit [Ping timeout: 260 seconds]
19:20 -!- mattn_jp [~mattn@s60.BMT-e1.vectant.ne.jp] has quit [Quit: Ex-Chat]
19:25 < skelterjohn> what error would you expect for timeouts?
19:26 < skelterjohn> btw i have no idea :)
19:27 < piranha> are there any tools for profiling go?  :)
19:28 < skelterjohn> goprof
19:29 < piranha> nice
19:29 < skelterjohn> gopprof i mean
19:29 < skelterjohn> i don' t know how to use it, though
19:29 < piranha> aha, found already
19:29 < piranha> heh
19:32 < piranha> hm, it seems it only displays profiling data, isn't it?
19:33 < piranha> well, anyway, it seems regular expressions are really slow
:(
19:33 < nictuku> piranha, what kind of profiling are you looking for?
19:34 < nictuku> check out http://shootout.alioth.debian.org/ too
19:34 < piranha> nictuku: well, I'm writing something like ack/grep, and I'm
in interesting situation right now - if I exclude file by regex patterns (by
matching filename), it makes tool slower than actually searching in every file for
content (also with regular expression)
19:34 < piranha> so I'm interested why is it so slow?  I've tried to combine
all regular expressions in a single (by joining by '|'), but this makes it even
slower
19:35 < |Craig|> skelterjohn: It will handshake for several minutes.  It
never times out.  I'm connecting to a client I wrote on the same computer, which
also gets no errors.
19:35 < piranha> path.Match is indeed much faster, but it's not regexp,
which is a shame...
19:36 -!- chomp [~ken@c-71-206-216-232.hsd1.pa.comcast.net] has joined #go-nuts
19:36 < nictuku> piranha, are you sure you're not doing something else
wrong?
19:37 < piranha> nictuku: well, if you're interested, you can look at it:
http://hg.piranha.org.ua/goreplace/file/tip/goreplace.go
19:37 < piranha> list of regular expressions is on line 24, their usage is
on line 98
19:38 < piranha> RegexList.Match is defined on line 197
19:38 < piranha> maybe []byte(s) copies something?
19:39 < nictuku> piranha, I'm reading, but in the meantime, try the
benchmark feature of the testing package.
19:39 < piranha> ok
19:40 < nictuku> it won't tell you what's slow, but it makes it easier to
iterate on improvements
19:40 < piranha> sure, at least I can look how this RegexpList.Match
performs
19:41 -!- Urmel| [~11087Urme@82-136-196-44.ip.telfort.nl] has joined #go-nuts
19:41 < piranha> btw, this is difference between them:
http://paste.in.ua/1849/#l-35,l-12
19:41 < piranha> second time is when I comment out call to RegexpList.Match
in VisitFile function
19:45 -!- virtualsue [~chatzilla@host81-139-70-65.in-addr.btopenworld.com] has
joined #go-nuts
19:47 < piranha> indeed, path.Match is 4-5 times faster, but I thought that
is negligible...
19:49 < nictuku> piranha, I don't see anything wrong with your regexp usage,
but it looks like you're reading the whole files into memory, and then working on
that
19:49 < nictuku> it might be better to process line by line
19:49 < piranha> nictuku: well, yes, but why is that bad?
19:50 < skelterjohn> path.Match only looks at the file name, right?
19:50 < piranha> hm, but reading whole file in memory and processing that is
faster than doing a lot of hdd seeks, no?
19:50 < nictuku> depends on the size of the files.
19:50 < piranha> skelterjohn: right :(
19:50 < piranha> nictuku: I skip files which are more than 10 mb in size :)
19:50 < nictuku> piranha, the hdd seeks wouldn't change if you process them
line by line
19:50 < piranha> hm, ok, what's the right way to read line by line?  :)
19:50 -!- tensorpudding [~user@99.56.160.152] has joined #go-nuts
19:51 < piranha> File.Read reads only by length, not by terminators, so it's
easier to read just whole file...
19:52 < nictuku> if you have infinite memory, yes :-)
19:52 < piranha> :-)))
19:52 < skelterjohn> piranha: you can use the bufio pkg to read line by line
19:53 < |Craig|> piranha: r.ReadString('\n')
19:53 < piranha> oh!
19:53 < piranha> thanks, haven't seen that
19:55 < |Craig|> ha, I just had a dynamic language fail.  I assigned a tuple
of arguments over a function instead of calling it in python, and had a lot of
trouble finding it.  I'm so happy that kind of thing can't happen in go.
20:00 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Ping timeout: 255 seconds]
20:06 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
20:10 < napsy> How could I create an io.Reader from my struct so I can use
it with binary.Read()
20:11 < skelterjohn> what's your goal?  raw bytes of the struct?
20:11 < napsy> yes
20:12 < skelterjohn> you can use unsafe
20:12 < skelterjohn> unsafe can tell you how many bytes, and turn it into a
byte slice
20:12 < napsy> hm I tried that but didn;t succeed
20:16 < edsrzf> Probably easier to turn it into an array first and then
slice the array.
20:17 < edsrzf> Otherwise you have to worry about manipulating the slice
header (length, capacity) yourself.
20:17 < piranha> nictuku: skelterjohn: did with bufio and now it's as slow
as python version :-)
20:17 < piranha> good bye bufio, I don't need to seek in big files anyway :)
20:18 < skelterjohn> edsrzf: problem is you'd need to know the size of the
array ahead of time
20:18 < skelterjohn> which is possible
20:18 -!- aho [~nya@fuld-590c7e54.pool.mediaWays.net] has joined #go-nuts
20:18 < skelterjohn> but when it's some arbitrary data structure, it's not
obvious
20:18 -!- mbernstein [~michael@cpe-70-113-7-72.austin.res.rr.com] has quit [Ping
timeout: 255 seconds]
20:18 < skelterjohn> and unsafe.Sizeof is a runtime operation
20:18 < edsrzf> unsafe.Sizeof is a compile time constant
20:18 < napsy> edsrzf: hm are there any examples how to do that?
20:19 < skelterjohn> is it?
20:19 < skelterjohn> cool - use that :)
20:19 < ww> hmmm...  nice
20:19 < ww> changeset: 7634:b082d4fa0f3c
20:19 < edsrzf> Yeah, it is.
20:19 < edsrzf> From the spec:
20:19 < ww> gob: enable the GobEncoder and GobDecoder interfaces.
20:19 < ww> These allow data items to control their own representation.
20:19 < edsrzf> "Calls to Alignof, Offsetof, and Sizeof are compile-time
constant expressions of type int.  "
20:19 < skelterjohn> const S = unsafe.Sizeof(mystruct); data :=
*(&[S]byte)unsafe.Pointer(&theStructure)
20:20 < skelterjohn> assuming you can make S like that
20:20 < napsy> jesus
20:20 < skelterjohn> is it that intimidating?
20:21 < napsy> lots of casting
20:21 < skelterjohn> one cast!
20:22 < skelterjohn> later yall
20:22 < skelterjohn> heading out for the night
20:22 < napsy> oh sorry
20:22 < skelterjohn> ah - yeah unsafe.Pointer is a function
20:23 < skelterjohn> err
20:23 < skelterjohn> sorry - unsafe.New not unsafe.Pointer
20:23 < skelterjohn> unsafe.Pointer is a type
20:23 < skelterjohn> but maybe it would work anyway
20:23 < skelterjohn> i also meant *(&[S]byte)(unsafe.Pointer(&theStructure))
20:24 < skelterjohn> C-style casts don't work
20:24 < skelterjohn> anyway, i'm gone
20:26 < napsy> hm still doesn't work
20:26 -!- DerHorst [~Horst@e176103212.adsl.alicedsl.de] has quit [Remote host
closed the connection]
20:26 < napsy> syntax error: unexpected ), expecting { or {
20:29 < edsrzf> What exactly do you have?
20:29 < napsy> data := *(&[S]byte)(unsafe.New(&header))
20:30 < edsrzf> Try (*[S]byte)(unsafe.Pointer(&header))
20:30 < edsrzf> Well, that'll give you a pointer to an array instead of an
array, but it should compile anyway.
20:31 < napsy> tnx it works now
20:42 -!- axo [~axo@c-71-192-75-183.hsd1.ma.comcast.net] has joined #go-nuts
20:48 -!- toyoshim_ [~toyoshim@y253149.dynamic.ppp.asahi-net.or.jp] has joined
#go-nuts
20:48 < chomp> Just to verify that I actually understand the documentation,
does bufio.Reader.ReadSilce immediately return with an EOF error if the buffer is
empty?
20:50 < napsy> ok a dumb question ...  can I convert an array to a slice?
20:51 < chomp> when you say convert, you mean?
20:52 < chomp> if you have an array a, you can refer to a slice over the
entire array using a[:]
20:52 < napsy> oh, nice
20:55 -!- fenicks [~fenicks@log77-3-82-243-254-112.fbx.proxad.net] has quit [Ping
timeout: 264 seconds]
21:04 -!- pothos_ [~pothos@111-240-171-231.dynamic.hinet.net] has joined #go-nuts
21:04 -!- femtoo [~femto@95-89-198-8-dynip.superkabel.de] has quit [Ping timeout:
255 seconds]
21:06 -!- pothos [~pothos@111-240-169-63.dynamic.hinet.net] has quit [Ping
timeout: 276 seconds]
21:11 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller,
Faster, Easier.  http://miranda-im.org]
21:13 -!- vexd [~vex@91-65-134-239-dynip.superkabel.de] has quit [Quit: leaving]
21:21 -!- stalled [~stalled@unaffiliated/stalled] has quit [Ping timeout: 250
seconds]
21:24 -!- Fish- [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has quit [Quit: So
Long, and Thanks for All the Fish]
21:31 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has joined #go-nuts
21:32 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
21:47 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Ping timeout: 252 seconds]
21:47 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
21:52 -!- visof [~visof@unaffiliated/visof] has quit [Read error: Connection reset
by peer]
21:53 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
21:53 < chomp> hrmm..  is there any way to create a new string from a []byte
of utf-8 data?
21:55 < nictuku> string(data) ?
21:56 < chomp> >< ...  really.  how did i miss that?
21:56 < nictuku> :-)
21:57 < chomp> ah.  found it in the documentation.  Conversions.  doh :p
21:58 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Ping timeout: 276 seconds]
21:58 -!- axo [~axo@c-71-192-75-183.hsd1.ma.comcast.net] has quit [Quit: leaving]
22:03 -!- tobel [~tobel@pD9E89AB4.dip.t-dialin.net] has joined #go-nuts
22:03 -!- tobel [~tobel@pD9E89AB4.dip.t-dialin.net] has quit [Client Quit]
22:04 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
22:09 -!- zozoR [~Morten@56346ed3.rev.stofanet.dk] has quit [Remote host closed
the connection]
22:13 -!- PortatoreSanoDiI [~Marvin@82.84.99.90] has quit [Quit: E se abbasso
questa leva che succ...]
22:17 -!- Scorchin [~Scorchin@host109-156-218-122.range109-156.btcentralplus.com]
has joined #go-nuts
22:21 -!- piranha [~piranha@5ED4B890.cm-7-5c.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
22:26 -!- vinisterx [~ryan@74-129-201-27.dhcp.insightbb.com] has quit [Read error:
Operation timed out]
22:28 -!- vinisterx [~ryan@74-129-201-27.dhcp.insightbb.com] has joined #go-nuts
22:36 -!- Eko [~eko@c-24-130-224-186.hsd1.ca.comcast.net] has quit [Quit: Leaving]
22:51 -!- tarrant [~tarrant@69.169.141.202.provo.static.broadweavenetworks.net]
has quit [Quit: Leaving...]
22:54 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has quit [Read
error: Connection reset by peer]
22:55 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has joined
#go-nuts
23:00 < mpl> chomp: because you never thought it would be that simple :)
23:00 < steven> guys, im a little confused about what im seeing here..  its
a really simple case of the select statement, and i expect the select statement to
return instantly when the user enters text, but it doesnt happen right awaay
23:00 -!- Natch [~natch@c-6dcde155.25-4-64736c10.cust.bredbandsbolaget.se] has
joined #go-nuts
23:00 -!- binarypie [~binarypie@c-24-6-151-185.hsd1.ca.comcast.net] has quit [Ping
timeout: 255 seconds]
23:00 < chomp> hah.  yeah, i was scouring the utf8 package docs and
considering some horrible bastardization like looping over with DecodeRune
23:01 < steven> https://gist.github.com/856811
23:02 -!- nixness [~dsc@78.100.210.180] has quit [Quit: Leaving]
23:02 < steven> see how simple it is?  yet it doesnt behave like i would
expect..  the select statement captures the chan receive of the goroutine of
Stdin, but it seems to wait to execute that case statement until the network one
is received as well...
23:02 < steven> can anyone help my sanity and tell me what im
misunderstanding here?
23:03 -!- Natch| [~natch@c-6dcde155.25-4-64736c10.cust.bredbandsbolaget.se] has
quit [Ping timeout: 240 seconds]
23:04 -!- jumzi [~none@c-89-233-234-125.cust.bredband2.com] has quit [Ping
timeout: 246 seconds]
23:05 -!- foocraft [~dsc@78.100.210.180] has joined #go-nuts
23:05 < chomp> woot.  aside from the terrible lack of proper client-side
terminal emulation, my go+js+websockets web browser remote shell is functioning :D
23:05 < steven> oooh.  im assuming its waiting on the network for the
Reader, but its actually net.Dial thats waiting..  so the goroutines never come
into existance until ive waited a while
23:05 < steven> awesome!
23:14 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
23:14 -!- jumzi [~none@c-89-233-234-125.cust.bredband2.com] has joined #go-nuts
23:23 -!- Scorchin [~Scorchin@host109-156-218-122.range109-156.btcentralplus.com]
has quit [Quit: Scorchin]
23:24 -!- brad_ [~brad@cpe-098-026-053-035.nc.res.rr.com] has joined #go-nuts
23:25 < brad_> in go how do you typecast something into another type?
23:25 < aiju> foo(bar)
23:25 < steven> type(obj)
23:25 < brad_> like, if I want a string as a byte array
23:25 < brad_> or a bool as a string
23:25 < brad_> ahh
23:25 < steven> []byte(str)
23:25 < aiju> bool as a string is not a cast
23:25 < brad_> thanks
23:25 < steven> bools and strings, i dont know if they can cast
23:25 < aiju> it's a conversion
23:25 < aiju> see the strconv package
23:26 < brad_> thanks
23:26 < steven> bool(s)?  or string(b)?  i dont know if they work
23:26 < aiju> steven: no
23:26 < steven> strconv is nice.
23:26 < steven> ive used it for Atoi, etc
23:26 < aiju> casts only work when the internal representation is the same
or at least largely similar
23:28 < brad_> thanks, that seems to have done the trick
23:35 -!- alkavan_ [~alkavan@IGLD-84-228-193-27.inter.net.il] has left #go-nuts
["Leaving"]
23:36 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller,
Faster, Easier.  http://miranda-im.org]
23:36 -!- sauerbraten [~sauerbrat@p508CAE07.dip.t-dialin.net] has quit [Remote
host closed the connection]
23:46 -!- virtualsue [~chatzilla@host81-139-70-65.in-addr.btopenworld.com] has
quit [Ping timeout: 248 seconds]
23:50 -!- napsy [~luka@tm.213.143.73.175.lc.telemach.net] has quit [Ping timeout:
260 seconds]
23:52 -!- Sgm [Sgm@bl16-17-218.dsl.telepac.pt] has joined #go-nuts
23:53 -!- Sgm [Sgm@bl16-17-218.dsl.telepac.pt] has left #go-nuts []
--- Log closed Sun Mar 06 00:00:55 2011