Go Language Resources Go, golang, go... NOTE: This page ceased updating in October, 2012

--- Log opened Fri Dec 31 00:00:01 2010
00:00 < Namegduf> You presumably want to write to something.
00:00 < Namegduf> Go look for that something.
00:00 -!- plexdev [~plexdev@arthur.espians.com] has joined #go-nuts
00:05 < tylergillies> its not created.  im trying to create an object i can
write to
00:06 < tylergillies> i just don't know how
00:06 < Namegduf> "Not that way"
00:06 < tylergillies> lol
00:06 < Namegduf> io.Writer is an interface, not a thing that does anything
00:06 < tylergillies> right
00:06 < aiju> tylergillies: what are you trying to do?
00:06 < Namegduf> Presumably you also want a thing you can read from, too
00:06 < tylergillies> aiju: https://gist.github.com/760498
00:07 < Namegduf> If you want a pipe, you can make one of those.
00:07 < tylergillies> i was just going to throw a string at it
00:08 < aiju> if you want a string use the Marshals
00:08 < Namegduf> Well, you presumably want to be able to read the data back
out of whatever you're writing it to.
00:08 < aiju> the Encoder/Decoder is for files, pipes or whatever
00:09 < tylergillies> aiju: thnx
00:10 < tylergillies> heres my high level idea: i want to pull json from a
webservice, but i don't know for sure what the keys of the json are, how can i
create a struct that uses the keys iff they are unknown beforehand?
00:10 -!- tvw [~tv@e176006186.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
00:10 < Namegduf> Unmarshal into an interface{}
00:10 < Namegduf> If you unmarshal a JSON object into an interface it
creates a map[string]interface{}
00:14 < tylergillies> Namegduf: thanks
00:14 -!- Davidian1024 [~Davidian1@173.88.174.84] has joined #go-nuts
00:17 -!- Scorchin [~Scorchin@host109-152-121-250.range109-152.btcentralplus.com]
has quit [Quit: Scorchin]
00:19 < tylergillies> Namegduf: var foobar interface{}
00:19 < tylergillies> json.Unmarshal([]byte(res.Body),foobar) ?
00:19 < Namegduf> &foobar
00:19 < tylergillies> i need to learn about pointers better
00:19 < Namegduf> To have something be changed, when passing it into a
function, you need to pass a pointer to it.
00:19 < tylergillies> going from untyped languages to typed languages is
weird
00:20 < Namegduf> Maps and slices inherently are reference types and behave
as pointers to the data in them.
00:20 < tylergillies> oooh
00:20 < tylergillies> that makes a lot of sense, thanks
00:20 < Eko> (though map data is immutable)
00:20 < Namegduf> Well, no, not in this sense
00:20 < aiju> tylergillies: pointers are just what the name says - they
point to data
00:20 < Namegduf> An individual map entry is immutable, but the map data as
a whole isn't.
00:20 < Eko> map values are immutable, I gue
00:21 < Namegduf> i.e.  if you pass a map the map reference gets copied but
inserts into it show up on the copy you had originally.
00:21 < tylergillies> aiju: i understand the concept, just don't have
experience actually doing it
00:21 < Eko> but they can be pointers to values which are, of course, then
mutable.
00:21 < aiju> ugh
00:21 < aiju> i don't like the whole mutable/immutable concept
00:21 < aiju> it is based on too weird assumptions
00:22 < Namegduf> Well, you don't run into it often in Go.
00:22 < Namegduf> Maps kind of inherently need it because that's how hash
tables work.
00:22 < tylergillies> woohoo it worked
00:22 < Namegduf> You can't mutate a key.
00:22 < tylergillies> Namegduf: thanks
00:22 < Namegduf> No problem.
00:23 < Namegduf> You don't usually need to pass pointers to an interface,
because you don't want to change the interface itself, you want to change whatever
it provides methods for.
00:23 < Namegduf> But in this case, you did want to change what the
interface pointed at.
00:24 -!- Davidian1024 [~Davidian1@173.88.174.84] has quit [Ping timeout: 276
seconds]
00:25 < tylergillies> i love the "genericness" of "for"
00:25 < tylergillies> im assuming i can treat this new interface map as a
range and iterate over it
00:25 < aiju> well, most of for is just like in C
00:26 < Namegduf> Yes, but you'd need to do a type assertion to extract it.
00:27 < tylergillies> blah: chan.go:29: cannot range over foobar (type
interface { })
00:27 < tylergillies> so []map(foobar)?
00:28 < Namegduf> Look up type assertions.
00:28 < tylergillies> ok
00:28 < Namegduf> It asserts that the value of an interface is a given type,
and gives you that type in a variable.
00:29 -!- wrtp [~rog@88.210.132.85] has quit [Quit: wrtp]
00:30 < tylergillies> so like foobar.(map)
00:30 < tylergillies> asserts that foobar is a map?
00:30 < Namegduf> .(map[string]interface{})
00:30 < Namegduf> "map" itself isn't a type.
00:30 < tylergillies> oh
00:30 < Namegduf> But yes.
00:31 < tylergillies> map[string]interface{} is a type?
00:33 < tylergillies> i need to study maps
00:33 < Namegduf> Yes.
00:33 < aiju> how to convert a byte array to a string?
00:34 < Namegduf> string(byteArray[:])
00:34 < Namegduf> Possibly works without the [:]
00:34 < Namegduf> Possibly not
00:34 < aiju> nope
00:34 < aiju> but it works w/
00:34 < aiju> how does it handle null bytes?
00:35 -!- emjayess [~emjayess@24-116-86-22.cpe.cableone.net] has quit [Quit:
Leaving]
00:37 < aiju> they don't seem to be stripped off…
00:37 < Namegduf> They won't be, no.
00:37 < Namegduf> Go strings do not treat null bytes specially.
00:37 < Namegduf> They aren't null terminated.
00:39 -!- photron_ [~photron@port-92-201-141-253.dynamic.qsc.de] has quit [Read
error: Operation timed out]
00:42 -!- nettok [~quassel@200.119.168.48] has quit [Ping timeout: 265 seconds]
00:43 -!- Davidian1024 [~Davidian1@cpe-173-88-174-84.neo.res.rr.com] has joined
#go-nuts
00:44 -!- wrtp [~rog@88.210.132.85] has joined #go-nuts
00:45 < tylergillies> is there a way to return the keys of a map?
00:46 < Namegduf> range.
00:47 < MaybeSo> e.g., for k, _ := range myMap { ...  do something with k
...  }
00:48 < tylergillies> oh nice
00:48 < tylergillies> thanks
00:48 < TheSeeker> Do you need to use locking to keep other stuff from
messing with myMap while you're ranging?  :|
00:48 < MaybeSo> if your program is written in such a way that multiple
goroutines might have access to the map, then yes
00:48 < MaybeSo> they tend to discourage that style of programming though
00:49 < Namegduf> Generally you should write it to not be that way, though
00:50 < MaybeSo> they offered a nice blog entry showing how you could send
your data through channels, ensuring only one goroutine at a time had access:
http://blog.golang.org/2010/07/share-memory-by-communicating.html
00:51 < MaybeSo> and http://golang.org/doc/codewalk/sharemem/
00:57 -!- wrtp [~rog@88.210.132.85] has quit [Quit: wrtp]
01:10 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-auoclroyfdlqeqex]
has joined #go-nuts
01:13 -!- daharon [~daharon@173-11-102-86-SFBA.hfc.comcastbusiness.net] has quit
[Quit: Leaving]
01:14 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has joined #go-nuts
01:17 < tylergillies> how would i create a 16 byte long variable?
01:17 < tylergillies> of type []byte
01:30 -!- Venom_X [~Venom_X@74.61.90.217] has joined #go-nuts
01:34 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
01:38 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has quit [Quit: Morten.  Desu~]
01:40 -!- skelterjohn [~jasmuth@c-68-45-238-234.hsd1.nj.comcast.net] has joined
#go-nuts
01:52 -!- Venom_X [~Venom_X@74.61.90.217] has quit [Remote host closed the
connection]
02:02 -!- aiju [~aiju@unaffiliated/aiju] has quit [Ping timeout: 260 seconds]
02:02 -!- aiju [~aiju@unaffiliated/aiju] has joined #go-nuts
02:11 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts
02:13 < KBme> make([]byte, 16)
02:14 -!- exch [~exch@h78233.upc-h.chello.nl] has joined #go-nuts
02:15 -!- wrtp [~rog@88.210.132.85] has joined #go-nuts
02:18 -!- wrtp [~rog@88.210.132.85] has quit [Client Quit]
02:19 -!- kingfishr [~kingfishr@c-98-207-87-183.hsd1.ca.comcast.net] has joined
#go-nuts
02:20 -!- tensorpudding [~user@99.56.169.128] has joined #go-nuts
02:25 -!- amacleod [~amacleod@pool-96-252-93-11.bstnma.fios.verizon.net] has
joined #go-nuts
02:29 < KBme> Eko: shouldn't you send a JOIN reply to a JOIN for a channel?
02:31 < raylu> KBme: huh?
02:31 < Namegduf> There's no JOIN reply distinct from the same notification
of a user joining that everyone else gets.
02:33 -!- daxt [~daxt@112.135.72.223] has joined #go-nuts
02:34 < KBme> right
02:36 -!- xash [~xash@d065036.adsl.hansenet.de] has quit [Ping timeout: 240
seconds]
02:50 -!- shvntr [~shvntr@116.26.129.139] has joined #go-nuts
02:53 -!- emet [~kvirc@unaffiliated/emet] has joined #go-nuts
02:53 -!- boscop_ [~boscop@f055010023.adsl.alicedsl.de] has joined #go-nuts
02:55 -!- kn100 [~kn100@unaffiliated/kn100] has joined #go-nuts
02:56 -!- boscop [~boscop@g225220058.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
03:01 -!- kn100 [~kn100@unaffiliated/kn100] has left #go-nuts ["Leaving"]
03:06 -!- l00t [~i-i3id3r_@189.105.4.231] has quit [Ping timeout: 240 seconds]
03:15 -!- Venom_X [~pjacobs@66.54.185.131] has quit [Quit: Venom_X]
03:18 -!- l00t [~i-i3id3r_@189.105.14.90] has joined #go-nuts
03:18 -!- daxt_ [~daxt@112.135.80.24] has joined #go-nuts
03:20 -!- daxt [~daxt@112.135.72.223] has quit [Ping timeout: 255 seconds]
03:25 -!- karshan [~karshan@117.254.216.210] has joined #go-nuts
03:26 -!- daxt_ [~daxt@112.135.80.24] has quit [Ping timeout: 240 seconds]
03:30 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has quit [Quit:
DarthShrine]
03:53 -!- karshan [~karshan@117.254.216.210] has quit [Ping timeout: 255 seconds]
04:06 < raylu> i'm having some trouble compiling go on a 32-bit machine that
worked previously.  on release 2010-12-22, i get https://pastee.org/7r4cw
04:13 -!- Wiz126 [~Wiz@24.229.245.72.res-cmts.sm.ptd.net] has joined #go-nuts
04:15 < tylergillies> https://gist.github.com/760706
04:15 < tylergillies> this is truncating my message
04:16 < tylergillies> 64 characters copied
04:16 < tylergillies> four score and seven years ago my father brought to
this land so
04:18 < TheSeeker> something not getting flushed?
04:25 < tylergillies> hrmm...  if i put trailing spaces on the input string
it works fine
04:26 -!- amacleod [~amacleod@pool-96-252-93-11.bstnma.fios.verizon.net] has quit
[Remote host closed the connection]
04:30 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 276 seconds]
04:34 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has quit [Ping timeout: 240
seconds]
04:54 -!- shvntr [~shvntr@116.26.129.139] has quit [Ping timeout: 272 seconds]
04:55 -!- shvntr [~shvntr@116.26.129.139] has joined #go-nuts
05:39 -!- emet [~kvirc@unaffiliated/emet] has quit [Quit: KVIrc 4.0.2 Insomnia
http://www.kvirc.net/]
05:56 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has joined
#go-nuts
06:17 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
06:18 -!- cbeck1 [cbeck@gateway/shell/pdx.edu/x-yykrtlhbrggxlldm] has joined
#go-nuts
06:18 -!- cbeck [cbeck@gateway/shell/pdx.edu/x-qragvborwdpjnzxm] has quit [Read
error: Connection reset by peer]
06:33 -!- larva [~larvanitr@ec2-46-51-171-183.eu-west-1.compute.amazonaws.com] has
joined #go-nuts
06:37 -!- ygd [~ygd@adsl-67-121-210-206.dsl.sndg02.pacbell.net] has joined
#go-nuts
06:37 < ygd> is anyone here?
06:37 -!- shvntr [~shvntr@116.26.129.139] has quit [Quit: leaving]
06:37 < ygd> are there any html parsers (like BeautifulSoup for python) on
go?
06:38 < Eko> ygd: yes; check the package list at
http://godashboard.appspot.com/
06:39 < Eko> so, I just learned something that I think I have been doing
mistakenly for awhile...  for ...  := range x {} works when x is nil!  :D
06:40 < Eko> I've been thinking too much like C, where trying to range over
something nil would be a Bad Thing.
06:40 < Eko> *iterate *NULL
06:40 < ygd> eko: what's it called?
06:41 < Eko> ygd: I don't know.
06:41 < Eko> let me google that for you
06:41 < Eko> .http://golang.org/pkg/html/
06:42 < Eko> so not even third-party.
06:42 < Namegduf> It only handles HTML5 complaint stuff, I think
06:42 < Namegduf> Not sure
06:43 < ygd> eko: i was thinking somewhat more complex, like beautifulsoup
06:43 < ygd> maybe i'll try porting it
06:46 -!- ygd [~ygd@adsl-67-121-210-206.dsl.sndg02.pacbell.net] has left #go-nuts
[]
06:46 < anticw> yugui: beautifulsoup is actually quite a nice way of parsing
xml/html in simple ways
06:47 < anticw> i looked at the code a whlie ago, and afaict it's pure
python and regex based, so you could more or less reimplement it natively
06:47 < anticw> idiomatically it might not be very clean in some ways, but
you can address that later
06:49 * Eko was just asked if there were any html parsers and answered as such ;-)
06:50 < Eko> and you are indeed encouraged to try to port libraries to go
and submit them for inclusion on godashboard so other people can use them.
07:01 < vsmatck> Hm. It seems like in reflect you can find struct fields by
name.  But you can't iterate through struct fields and get their names.  Is this
right?
07:07 < vsmatck> No that's not right.  I found my answer.  bah
07:09 < vsmatck> I was doing some unmarshaling backwards.  Taking the key of
a map and checking to see if there was struct field with that name.  Should be
opposite for efficiency.
07:12 < Eko> my code is so freaking full of "range"s, lol.  practically
every for loop.
07:13 < vsmatck> I read a blog post today that seemed relevant to Go. Guy
was talking about how when making large changed (architecture type changes) to a
program in a language with a higher level of abstraction you have to take fewer
steps between the current state of your program, and the destination state you
want to be at.
07:13 < vsmatck> So you have long periods of time where nothing builds.
I've experienced this first hand with C++.
07:14 < vsmatck> With Go I can take more reasonable smaller steps.  *shrugs*
07:15 -!- illya77 [~illya77@245-87-133-95.pool.ukrtel.net] has joined #go-nuts
07:16 < vsmatck> I've also noticed that non-insane compiler errors are nice
for refactoring.  When refactoring I notice I lean on the compiler.  I make a
change and then let the compiler tell me everywhere it broke.
07:16 < vsmatck> This is way less reasonable to do with C++ because the
error messages are so insane.
07:17 < vsmatck> If anyone is interested in checking it out.
http://michaelfeathers.typepad.com/michael_feathers_blog/2010/12/making-too-much-of-tdd.html
07:22 -!- shvntr [~shvntr@116.26.129.139] has joined #go-nuts
07:26 < fuzzybyte> vsmatck: very interesting & nice writing
07:27 < vsmatck> I agree.  I wish I had writing like that.  :)
07:29 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
07:35 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
07:42 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Ping timeout: 255
seconds]
07:50 -!- xash [~xash@d047134.adsl.hansenet.de] has joined #go-nuts
07:57 -!- xuwen [~xuwen@pool-138-88-67-134.res.east.verizon.net] has quit [Remote
host closed the connection]
08:00 -!- xash [~xash@d047134.adsl.hansenet.de] has quit [Ping timeout: 255
seconds]
08:01 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts
08:07 < taruti> Are there any special issues with code like func foo(chptr
*chan Foo) { ...; if chptr!=nil { *chptr := mychan } } ?
08:09 -!- piranha [~piranha@5ED42E59.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
08:37 -!- bgentry [~bgentry@75.85.173.206] has quit [Quit: bgentry]
08:38 -!- ExtraSpice [~XtraSpice@88.118.33.48] has joined #go-nuts
08:39 -!- pothos [~pothos@111-240-213-117.dynamic.hinet.net] has quit [Ping
timeout: 246 seconds]
08:43 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
08:47 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
08:58 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has joined
#go-nuts
08:58 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has quit
[Changing host]
08:58 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
09:09 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has joined #go-nuts
09:09 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has left #go-nuts []
09:13 -!- Project_2501 [~Marvin@82.84.70.92] has joined #go-nuts
09:14 -!- Wiz126 [~Wiz@24.229.245.72.res-cmts.sm.ptd.net] has quit [Ping timeout:
246 seconds]
09:18 -!- photron_ [~photron@port-92-201-111-143.dynamic.qsc.de] has joined
#go-nuts
09:20 -!- kanru1 [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts
09:21 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Read error:
Connection reset by peer]
09:48 -!- sacho [~sacho@79-100-51-54.btc-net.bg] has quit [Ping timeout: 240
seconds]
09:49 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has joined #go-nuts
10:13 -!- Scorchin [~Scorchin@host109-154-144-121.range109-154.btcentralplus.com]
has joined #go-nuts
10:13 -!- tvw [~tv@e176000148.adsl.alicedsl.de] has joined #go-nuts
10:14 -!- illya77 [~illya77@245-87-133-95.pool.ukrtel.net] has quit [Ping timeout:
255 seconds]
10:35 -!- illya77 [~illya77@238-36-133-95.pool.ukrtel.net] has joined #go-nuts
10:51 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
10:52 -!- femtoo [~femto@95-89-249-94-dynip.superkabel.de] has joined #go-nuts
10:53 -!- femtooo [~femto@95-89-249-94-dynip.superkabel.de] has joined #go-nuts
10:53 -!- skejoe [~skejoe@188.114.142.162] has joined #go-nuts
10:57 -!- Fish [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has joined #go-nuts
11:00 -!- araujo [~araujo@190.38.51.34] has joined #go-nuts
11:00 -!- araujo [~araujo@190.38.51.34] has quit [Changing host]
11:00 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
11:04 -!- rlab [~Miranda@36-231-95-178.pool.ukrtel.net] has joined #go-nuts
11:14 -!- tensorpudding [~user@99.56.169.128] has quit [Remote host closed the
connection]
11:35 -!- wrtp [~rog@88.210.132.85] has joined #go-nuts
11:36 -!- wrtp [~rog@88.210.132.85] has quit [Client Quit]
11:38 -!- wrtp [~rog@88.210.132.85] has joined #go-nuts
11:47 -!- xash [~xash@d003027.adsl.hansenet.de] has joined #go-nuts
11:50 -!- Project-2501 [~Marvin@82.84.88.80] has joined #go-nuts
11:53 -!- Project_2501 [~Marvin@82.84.70.92] has quit [Ping timeout: 264 seconds]
11:55 -!- exch [~exch@h78233.upc-h.chello.nl] has quit [Quit: leaving]
12:01 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has quit [Remote host closed the
connection]
12:02 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has joined #go-nuts
12:04 -!- exch [~exch@h78233.upc-h.chello.nl] has joined #go-nuts
12:06 -!- Eko [~eko@adsl-76-251-235-206.dsl.ipltin.sbcglobal.net] has quit [Quit:
This computer has gone to sleep]
12:07 -!- kanru1 [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Ping timeout:
276 seconds]
12:10 -!- ExtraSpice [~XtraSpice@88.118.33.48] has quit [Ping timeout: 276
seconds]
12:20 -!- ExtraSpice [~XtraSpice@88.118.33.48] has joined #go-nuts
12:38 -!- femtooo [~femto@95-89-249-94-dynip.superkabel.de] has quit [Ping
timeout: 240 seconds]
12:38 -!- femtoo [~femto@95-89-249-94-dynip.superkabel.de] has quit [Ping timeout:
240 seconds]
12:52 -!- wrtp_ [~rog@88.210.132.85] has joined #go-nuts
12:52 -!- wrtp [~rog@88.210.132.85] has quit [Read error: Connection reset by
peer]
12:52 -!- femtoo [~femto@95-89-249-94-dynip.superkabel.de] has joined #go-nuts
12:52 -!- femtooo [~femto@95-89-249-94-dynip.superkabel.de] has joined #go-nuts
13:01 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
13:02 -!- wrtp [~rog@88.210.132.85] has quit [Quit: wrtp]
13:06 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has joined
#go-nuts
13:06 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has quit
[Changing host]
13:06 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
13:11 -!- wrtp [~rog@88.210.132.85] has joined #go-nuts
13:19 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has quit [Quit:
noktoborus]
13:20 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
13:44 -!- shvntr [~shvntr@116.26.129.139] has quit [Quit: leaving]
13:44 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
13:51 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has quit
[Remote host closed the connection]
13:54 -!- tvw [~tv@e176000148.adsl.alicedsl.de] has quit [Remote host closed the
connection]
13:57 -!- napsy [~luka@88.200.96.18] has quit [Quit: Lost terminal]
13:57 -!- LeNsTR [~lenstr@unaffiliated/lenstr] has quit [Quit: LeNsTR]
14:00 < KBme> man, I don't get the :parameters in irc
14:00 < KBme> i don't understand when they are needed
14:00 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
14:01 -!- LeNsTR [~lenstr@unaffiliated/lenstr] has joined #go-nuts
14:06 < kimelto> just to be sure, in this code http://pastebin.com/4hK3uW69,
the hl line (10) can be a problem, right?  the first goroutine to exit will close
the channel.
14:07 < kimelto> so I have to make something like this
http://pastebin.com/4N51f24U?
14:07 < kimelto> plus protect the decrement operation?
14:07 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has joined
#go-nuts
14:07 < KBme> err
14:08 < taruti> KBme: what are you hacking?
14:08 < KBme> irc client
14:08 < taruti> cool, sources online?
14:08 < KBme> kimelto: well, if out is used by other goroutines it might not
be a good idea to close it
14:08 -!- LeNsTR [~lenstr@unaffiliated/lenstr] has quit [Quit: LeNsTR]
14:08 < KBme> taruti: sure, http://github.com/soul9/go-irc-chans
14:09 < kimelto> I have multiple writers to out, a single reader.
14:09 < KBme> taruti: if you check it out tell me what you think
14:09 < KBme> kimelto: so yeah, you have to be carefull on how you close
that channel
14:09 < taruti> KBme: ok :)
14:09 < KBme> i wouldn't close it from the goroutines
14:09 < KBme> ;)
14:10 < kimelto> I dont see other alternatives :(
14:10 -!- LeNsTR [~lenstr@79.165.23.176] has joined #go-nuts
14:10 -!- LeNsTR [~lenstr@79.165.23.176] has quit [Changing host]
14:10 -!- LeNsTR [~lenstr@unaffiliated/lenstr] has joined #go-nuts
14:11 < KBme> kimelto: i'd pass a bool channel to the goroutines where they
send when they're don, then count how many are done and close the chan when all
goroutines are done
14:11 < KBme> something like that
14:11 < KBme> ah, i see the function...hmmm...
14:12 < KBme> well anyways, it's not a good idea imho..
14:13 < taruti> KBme: adding handlers for *all* messages would also be
useful
14:13 < KBme> taruti: ?
14:13 < KBme> if you mean in my irc client library, it's there: "*"
14:13 < taruti> ok :)
14:15 < kimelto> KBme: my `alive counter' feels more straight forward to me
than yet another goroutine to monitor the workers and close the channel.
14:16 < KBme> yes, but aliveworkers is this weird variable that's kind of
global
14:16 < KBme> i don't like to do that with goroutines
14:16 < KBme> got weird errors
14:16 < KBme> so i pass all variables in as parameters
14:17 < KBme> anyways, however you like ;)
14:17 -!- l00t [~i-i3id3r_@189.105.14.90] has quit [Quit: Leaving]
14:18 * KBme re-reads the rfc about :parameters
14:19 < kimelto> if I can make the monitoring goroutine generic enough to
work with all my workers it will defintely be a win.
14:19 < kimelto> cause, yeah, I have more than one function which look like
this :)
14:19 < KBme> yeah, it's not ideal
14:20 < KBme> ok, it seems :foo is only needed when parameters have spaces
14:23 < kimelto> mmh, how to accept a chan a whatever types ? :/
14:25 < KBme> interface{}
14:25 < KBme> but it gets ugly
14:25 < KBme> you have to do type assertions
14:45 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
14:45 -!- nsf [~nsf@jiss.convex.ru] has quit [Client Quit]
14:45 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
15:02 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has quit
[Remote host closed the connection]
15:03 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has joined
#go-nuts
15:03 -!- skejoe [~skejoe@188.114.142.162] has quit [Ping timeout: 240 seconds]
15:05 -!- skejoe [~skejoe@188.114.142.162] has joined #go-nuts
15:11 -!- skejoe [~skejoe@188.114.142.162] has quit [Ping timeout: 255 seconds]
15:12 -!- skejoe [~skejoe@188.114.142.162] has joined #go-nuts
15:18 -!- skejoe [~skejoe@188.114.142.162] has quit [Ping timeout: 276 seconds]
15:18 -!- skejoe [~skejoe@188.114.142.162] has joined #go-nuts
15:23 -!- kanru1 [~kanru@61-228-157-40.dynamic.hinet.net] has joined #go-nuts
15:24 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has quit
[Remote host closed the connection]
15:25 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has joined
#go-nuts
15:31 -!- wrtp [~rog@88.210.132.85] has quit [Quit: wrtp]
15:34 -!- xash [~xash@d003027.adsl.hansenet.de] has quit [Ping timeout: 265
seconds]
15:39 -!- Venom_X [~pjacobs@66.54.185.131] has joined #go-nuts
15:39 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has quit
[Remote host closed the connection]
15:44 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
15:45 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has joined
#go-nuts
16:00 -!- Fish [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has quit [Quit: So
Long, and Thanks for All the Fish]
16:01 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has quit
[Remote host closed the connection]
16:02 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has joined
#go-nuts
16:19 -!- piranha [~piranha@5ED42E59.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
16:24 < zozoR> why dont i get make.amd64 file when i use hg pull & hg update
release?
16:24 < zozoR> is that normal?:O
16:27 -!- arun [~arun@unaffiliated/sindian] has quit [Ping timeout: 260 seconds]
16:33 < temoto> zozoR, i had to change all my makefiles to include make.inc
16:33 < temoto> instead of make.$(GOARCH)
16:33 < zozoR> so make.inc should do it?
16:34 < zozoR> oh now it compiled
16:34 < zozoR> awesome :D
16:35 < zozoR> thanks
16:35 < zozoR> made me happy
16:36 -!- arun [~arun@unaffiliated/sindian] has joined #go-nuts
16:47 < temoto> I took the line from some package after update.
16:47 < temoto> I'm still not sure if it is correct or is it new official
standard.
16:55 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has quit [Quit: Morten.  Desu~]
16:56 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has joined #go-nuts
16:57 < KBme> it is
16:57 < KBme> it has been for a long while, too
16:57 < KBme> (log while at golang development pace)
16:57 < KBme> long*
16:59 -!- temoto [~temoto@81.19.91.15] has quit [Ping timeout: 240 seconds]
17:00 -!- piranha [~piranha@5ED4B890.cm-7-5c.dynamic.ziggo.nl] has joined #go-nuts
17:02 -!- illya77 [~illya77@238-36-133-95.pool.ukrtel.net] has quit [Quit:
illya77]
17:03 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has quit
[Remote host closed the connection]
17:04 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has joined
#go-nuts
17:22 -!- go-irc-ch [~go-irc-ch@2001:470:1f13:3b4:20a:e4ff:fe49:b68c] has quit
[Remote host closed the connection]
17:25 -!- kanru1 [~kanru@61-228-157-40.dynamic.hinet.net] has quit [Ping timeout:
250 seconds]
17:26 -!- femtooo [~femto@95-89-249-94-dynip.superkabel.de] has quit [Read error:
Connection reset by peer]
17:26 -!- femtoo [~femto@95-89-249-94-dynip.superkabel.de] has quit [Read error:
Connection reset by peer]
17:29 -!- binarypie [~binarypie@c-24-130-113-34.hsd1.ca.comcast.net] has joined
#go-nuts
17:33 -!- ExtraSpice [~XtraSpice@88.118.33.48] has quit [Ping timeout: 276
seconds]
17:40 < KBme> sorry for the join/part spam, i'll stop now
18:07 -!- mafs [~maikeru@unaffiliated/maikeru/x-7708887] has joined #go-nuts
18:07 -!- Eko [~eko@adsl-76-251-235-206.dsl.ipltin.sbcglobal.net] has joined
#go-nuts
18:07 -!- mafs [~maikeru@unaffiliated/maikeru/x-7708887] has left #go-nuts []
18:13 -!- nettok [~quassel@200.119.169.237] has joined #go-nuts
18:14 < tylergillies> whats the function to get ascii character for a
number?
18:14 < tylergillies> or better yet, what package is it in?
18:14 < aiju> byte(...)
18:14 < aiju> no need for an extra function ;)
18:16 < tylergillies> yay
18:16 -!- wrtp [~rog@88.210.132.85] has joined #go-nuts
18:17 < tylergillies> fmt.Println(byte(65)) prints "65"
18:18 < aiju> do you just want to print it?
18:18 < aiju> string(65) if you want a string
18:18 < TheSeeker> fmt.Println(string(byte(65))) ?
18:18 < aiju> fmt.Printf("%c", 65) if you just wanna print it
18:19 < tylergillies> aiju: TheSeeker: thnx
18:33 -!- binarypie [~binarypie@c-24-130-113-34.hsd1.ca.comcast.net] has quit
[Ping timeout: 240 seconds]
18:35 -!- rup [~rupert@78.159.100.188] has quit [Ping timeout: 276 seconds]
18:35 -!- rup [~rupert@deathknight.net] has joined #go-nuts
18:38 -!- soapy_illusions [~alex@bas1-montreal50-1279440699.dsl.bell.ca] has
joined #go-nuts
18:40 < soapy_illusions> hey, is there a way to fix this: I need the length
of this array, but I am returned a pointer to the array; len(getFoos()) where
getFoos() return []*Foo
18:41 < exch> []*oo is not a pointer to a slice.  it's a slice of pointers
of Foo
18:42 < exch> len() should work on that afaik
18:45 < soapy_illusions> invalid argument GetFiles() (type *[]MonitFile) for
len
18:46 < soapy_illusions> ohh wait
18:46 < soapy_illusions> it's returning a pointer to an array
18:46 < soapy_illusions> and like you said I wanted an array of pointers
18:48 < soapy_illusions> nvm then, thanks exch
18:50 -!- rup [~rupert@deathknight.net] has quit [Ping timeout: 250 seconds]
18:55 -!- rupert [~rupert@deathknight.net] has joined #go-nuts
18:56 -!- bgentry [~bgentry@75.85.173.206] has joined #go-nuts
19:08 -!- nsf [~nsf@jiss.convex.ru] has quit [Ping timeout: 276 seconds]
19:20 -!- nettok [~quassel@200.119.169.237] has quit [Ping timeout: 272 seconds]
19:28 -!- nettok [~quassel@200.119.169.237] has joined #go-nuts
19:39 -!- ExtraSpice [~XtraSpice@88.118.33.48] has joined #go-nuts
19:43 -!- PortatoreSanoDiI [~Marvin@82.84.65.170] has joined #go-nuts
19:47 -!- Project-2501 [~Marvin@82.84.88.80] has quit [Ping timeout: 250 seconds]
19:52 -!- Project_2501 [~Marvin@82.84.91.76] has joined #go-nuts
19:55 -!- PortatoreSanoDiI [~Marvin@82.84.65.170] has quit [Ping timeout: 264
seconds]
20:24 -!- soapy_illusions [~alex@bas1-montreal50-1279440699.dsl.bell.ca] has quit
[Ping timeout: 240 seconds]
20:27 -!- virtualsue [~chatzilla@host81-148-29-239.in-addr.btopenworld.com] has
joined #go-nuts
20:31 -!- eikenberry [~jae@ivanova.zhar.net] has quit [Quit: End of line.]
20:36 -!- binarypie [~binarypie@c-24-130-113-34.hsd1.ca.comcast.net] has joined
#go-nuts
20:42 < zozoR> http://pastebin.com/uG4Pj32b
20:43 < zozoR> why does my player struct not implement Draw??
20:43 < zozoR> because its func (self *player) Draw() and not func (self
player) Draw() ...  (The last one works)
20:44 < zozoR> error: player does not implement Drawer (Draw method requires
pointer receiver)
20:44 < Eko> zozoR: I need to see /*code*/
20:44 < Eko> my guess is that you have a var PlayObj player
20:44 < zozoR> true that
20:45 < Eko> when (as the error message is telling you) you need a PlayObj
:= new(player)
20:45 < zozoR> ah, it has to be a pointer :o
20:45 < Eko> though I might point out that your capitalization is somewhat
nonstandard
20:45 < zozoR> ah now it works :D
20:45 < zozoR> thanks
20:45 < zozoR> i know ''
20:45 < Eko> typically it's type Player ...  and play := new(Player).
20:45 < Eko> mk.
20:46 < zozoR> but, i gotta do this fast, i want to hit compile at new year
20:57 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has joined #go-nuts
21:02 -!- virtualsue [~chatzilla@host81-148-29-239.in-addr.btopenworld.com] has
quit [Ping timeout: 240 seconds]
21:02 -!- binarypie [~binarypie@c-24-130-113-34.hsd1.ca.comcast.net] has quit
[Remote host closed the connection]
21:02 -!- snearch [~snearch@f053005032.adsl.alicedsl.de] has joined #go-nuts
21:03 -!- tensai_cirno [~cirno@77.232.15.216] has joined #go-nuts
21:08 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
21:12 -!- piranha [~piranha@5ED4B890.cm-7-5c.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
21:25 < vsmatck> What's up with the new keyword?  I've never used it before.
21:26 < vsmatck> Err.  I mean, it's strange that I've been able to write so
much Go without using something that seems like it should be fundamental.
21:27 < vsmatck> Like is there a situation when you have to use it?
21:28 < Archwyrm> vsmatck: I don't use it much either, but some functions
will take pointers as an argument and fill them with data.
21:28 < Archwyrm> Then it is necessary for certain.
21:29 < vsmatck> Can't you just ptrToObj := &obj{}; myFunc(ptrToObj); ?
21:30 < Archwyrm> Sure, but maybe it isn't quite as readable.
21:31 < vsmatck> Hm. I never thought of that.  So maybe it's there for
read'ability.
21:32 < vsmatck> I guess make is the same way.  Maybe this is just sugar to
make people from other languages feel like they're in a familiar place.  I
remember a while back they were talking about merging new and make.  But decided
against it for roughly this reason.
21:34 < Archwyrm> Well, some things you can only do with make, such as set
the capacity of a slice, or create a channel.
21:35 < vsmatck> new could be overloaded for that purpose.
21:35 < tensai_cirno> good morning, fellas
21:35 < tensai_cirno> happy new year
21:35 < tensai_cirno> <:D
21:35 < vsmatck> I'm still in 2010.
21:35 < vsmatck> I'm communicating to you from your past!!!1111
21:35 < tensai_cirno> thirty minutes in 2011
21:36 < tensai_cirno> and I'm still sober
21:36 < vsmatck> You should probably wait another 1/2 hour before you break
that resolution.
21:36 < Archwyrm> vsmatck: I think that would be rather confusing.
21:36 < vsmatck> Another thing I notice.  When I write a receiver I always
call the receiver object "this".  Seems like that'd be a good keyword.
21:37 < Archwyrm> vsmatck: Usually you don't want a pointer to a slice, for
example, but in some cases you might.
21:37 < vsmatck> Archwyrm: ya I suppose.  You couldn't just remember new =
pointer, make = reference.  You'd have to remember what the reference types are.
21:37 < tensai_cirno> vsmatck, taking metro train with bottle of vodka to
center :3
21:38 < vsmatck> In what situation could you possibly want a pointer to a
slice?  I guess when you want to modify it's size and have the caller see it?
21:38 < vsmatck> I generally do the mySlice = modifySlice(mySlice) thing.
21:38 < Archwyrm> vsmatck: Yeah, the receivers names are probably up to
taste.  Personally, I like to treat it simply as another argument so I name it
appropriately.
21:39 < Archwyrm> I'm not really sure.  I've never needed a pointer to a
slice.  :)
21:39 < Archwyrm> But from what I have gathered from the go-nuts list is
there are corner cases.
21:40 < Archwyrm> Same with pointers to interfaces.
21:40 < vsmatck> ah
21:41 -!- rlab [~Miranda@36-231-95-178.pool.ukrtel.net] has quit [Quit: Miranda
IM! Smaller, Faster, Easier.  http://miranda-im.org]
21:59 -!- Project_2501 [~Marvin@82.84.91.76] has quit [Quit: E se abbasso questa
leva che succ...]
22:10 -!- Wiz126 [~Wiz@24.229.245.72.res-cmts.sm.ptd.net] has joined #go-nuts
22:14 -!- fabled [~fabled@mail.fi.jw.org] has quit [Quit: Ex-Chat]
22:22 -!- fabled [~fabled@83.145.235.194] has joined #go-nuts
22:27 -!- stalled [~stalled@unaffiliated/stalled] has quit [Read error: Connection
reset by peer]
22:29 -!- snearch [~snearch@f053005032.adsl.alicedsl.de] has quit [Quit:
Verlassend]
22:36 -!- Venom_X [~pjacobs@66.54.185.131] has quit [Quit: Venom_X]
22:37 < vsmatck> What's up with reflect.Uintptr?  What's that for?
22:41 < vsmatck> Is to have the type system protect a pointer gotten from
unsafe so that people don't try to deref it.
23:04 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
23:34 -!- wtfness [~dsc@89.211.107.85] has joined #go-nuts
23:34 -!- Scorchin [~Scorchin@host109-154-144-121.range109-154.btcentralplus.com]
has quit [Quit: Scorchin]
23:35 -!- foocraft [~dsc@78.100.216.131] has quit [Ping timeout: 240 seconds]
23:42 < tylergillies> im using a library that doesn't let me send objects to
functions: (http://www.getwebgo.com/), would would i tell one of the functions to
write to a channel?
23:42 < tylergillies> how would*
23:42 < Namegduf> Go doesn't have objects
23:43 < Namegduf> And you can't send to functions
23:43 < Namegduf> I don't know what you mean.
23:44 < tylergillies> hiw would i invoke a function with a channel as an
argument
23:44 < tylergillies> how*
23:44 < Namegduf> You'd pass it as a parameter.
23:44 < tylergillies> but you can't
23:44 < tylergillies> i gave link for context
23:44 < Namegduf> I don't feel like studying the API of an arbitrary library
from the top down to answer a question
23:45 < tylergillies> ok
23:45 < tylergillies> thnx anyway
23:45 < Namegduf> If it's an event handler, you can also pass a closure
which has a channel in the outer scope.
23:45 < tylergillies> thought there would be a work around without having to
do it the obvious way
23:45 < tylergillies> Namegduf: thnx
--- Log closed Sat Jan 01 00:00:01 2011