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

--- Log opened Fri May 06 00:00:50 2011
00:03 -!- nictuku [~yvesj@unaffiliated/nictuku] has quit [Ping timeout: 240
seconds]
00:03 -!- nictuku [~yvesj@74.125.121.33] has joined #go-nuts
00:03 -!- nictuku [~yvesj@74.125.121.33] has quit [Changing host]
00:03 -!- nictuku [~yvesj@unaffiliated/nictuku] has joined #go-nuts
00:06 -!- Kafo [5b9a04ad@gateway/web/freenode/ip.91.154.4.173] has quit [Ping
timeout: 252 seconds]
00:08 -!- thgrtuy [~thgrtuy@208-191-152-69.lightspeed.austtx.sbcglobal.net] has
joined #go-nuts
00:18 -!- pothos [~pothos@111-240-168-232.dynamic.hinet.net] has quit [Ping
timeout: 240 seconds]
00:19 < Namegduf> Argh.
00:19 < Namegduf> "Why don't we implement this count function, which
provides for loop with i++ behaviour but takes a closure and is slightly longer to
write"
00:20 < Makoryu> ( °_°)
00:21 -!- thiago__ [~thiago@189.59.134.193] has quit [Quit: bye]
00:25 < Namegduf> Is there any case where it's legal for a line in Go to
begin with #?
00:26 < Namegduf> Outside of multiline strings?
00:29 < TheSeeker> ok, thinking about starting to use Go again after a few
months of not looking at it ...  looks like a lot has changed.
00:37 -!- Tuller [~tuller@c-69-143-48-210.hsd1.va.comcast.net] has joined #go-nuts
00:40 -!- fmoo [~Adium@66.220.144.74] has quit [Quit: Leaving.]
00:45 -!- ghais [~ghais@c-68-32-79-77.hsd1.ga.comcast.net] has joined #go-nuts
00:45 -!- ghais [~ghais@c-68-32-79-77.hsd1.ga.comcast.net] has left #go-nuts []
00:46 -!- foocraft [~ewanas@78.101.69.106] has joined #go-nuts
00:47 < skelterjohn> TheSeeker: nothing fundamental
00:50 -!- ghais [~ghais@c-68-32-79-77.hsd1.ga.comcast.net] has joined #go-nuts
00:50 < ghais> Hello, what is the use case of embedding an anonymous
interface type in a struct, like in this code https://gist.github.com/958268?
00:51 < dfc> ghais: it is use heavily in combining the single method
interfaces, like Reader, Writer, Closer
00:51 < dfc> into more exciting versions
00:51 < dfc> like ReadWriteCloser
00:51 -!- Tuller [~tuller@c-69-143-48-210.hsd1.va.comcast.net] has quit [Quit:
muffins]
00:52 < dfc> hmm
00:52 < dfc> actualy
00:52 < dfc> sorry, that wasn't you exact question
00:52 < dfc> actually i can't see a use case
00:52 < ghais> :)
00:52 < dfc> you don't need to declare interfaces, just fulfill them
00:52 < skelterjohn> if you say
00:52 < skelterjohn> type X struct { SomeInterface }
00:52 < skelterjohn> and you have "var x X"
00:52 < skelterjohn> then x.SomeInterface = somethingThatImplementsIt
00:53 < skelterjohn> and i believe x will implement SomeInterface
00:53 < skelterjohn> not sure about that last bit
00:53 < Rennex> x and X, that's nice.
00:53 -!- fmoo [~Adium@66.220.144.74] has joined #go-nuts
00:53 < skelterjohn> i'm not super creative with my variable names
00:53 < skelterjohn> my children will be named "Boy" and "Girl"
00:53 < dfc> skelterjohn: that sounds like Mixins
00:53 < Namegduf> I've been looking at math stuff recently.
00:53 < dfc> sorta
00:54 < Namegduf> Just think of them as syntactic sugar for defining methods
which just pass through to the embedded item
00:54 < dfc> or sorta kinda polymorphism
00:54 < Namegduf> And the item's name happening to match its type.
00:54 < ghais> OK, I think that makes sense now.
00:54 < Namegduf> Depends what your definition of polymorphism is; embedding
does not give dynamic dispatch, but interfaces do whenever used.
00:54 < dfc> so you could have type T { io.Reader } ; var t T
00:55 < yebyen> iant: hey thanks, how about NewValue?
00:55 < Makoryu> I like it when people insist that polymorphism is another
word for inheritance
00:55 < dfc> t.Reader = os.Open("/dev/urandom")
00:55 < yebyen> wait
00:55 < dfc> t.Read(...) ?
00:55 < yebyen> someone else fixed it already
00:55 < Namegduf> Makoryu: Who did that?
00:56 < dfc> Makoryu: please don't read to much into my use of polymorphism
00:56 < Namegduf> dfc: That looks right
00:56 < dfc> I am just trying to couch my answer in terms of things I
already understand
00:56 < yebyen> well
00:56 < dfc> Namegduf: question is, why ?
00:56 < Namegduf> dfc: Because you can embed more than one type.
00:56 < Makoryu> Namegduf: Nobody here!  The discussion just reminded me of
hearing people do it all the time when talking about OOP languages
00:56 < Makoryu> dfc: I didn't mean you
00:56 < dfc> I guess to avoid having to have Glue methods
00:56 < Namegduf> Easiest to just view it as implicit glue methods.
00:57 < Namegduf> It can't do anything those can't.
00:57 < dfc> yeah
00:57 < Namegduf> i.e.  the "inner" object can't call methods on the outer
object, its methods aren't overriden by the ones on the outer object when it calls
them on itself, etc.
00:57 < plexdev> http://is.gd/YZQoMI by [Russ Cox] in go/lib/codereview/ --
create release-branch.r57
00:57 < plexdev> http://is.gd/A9OJHi by [Russ Cox] in go/src/pkg/xml/ --
[release-branch.r57] xml: fix reflect error
00:57 < dfc> so rather than type T { r io.Reader } ; t = &T{os.Open(...)}
00:57 < plexdev> http://is.gd/ylHNSS by [Russ Cox] in 2 subdirs of
go/src/pkg/image/ -- [release-branch.r57] image: png & jpeg encoding benchmarks
00:57 < plexdev> http://is.gd/iNEPkr by [Russ Cox] in go/src/pkg/http/ --
[release-branch.r57] http: new error for reading a body after it's been closed
00:57 < dfc> then having to add func (t *T) Read() ...
00:57 < plexdev> http://is.gd/p4IwTl by [Russ Cox] in
go/src/pkg/mime/multipart/ -- [release-branch.r57] mime/multipart: fix regression
from previous ReadSlice change
00:58 < Namegduf> dfc: Yeah.
00:58 < plexdev> http://is.gd/fQ4Cab by [Russ Cox] in go/src/pkg/http/ --
[release-branch.r57] http: rename ErrBodyReadAferClose to ErrBodyReadAfterClose
00:58 < dfc> to satisfy the os.Reader
00:58 < plexdev> http://is.gd/pANcxk by [Russ Cox] in 2 subdirs of
go/src/pkg/ -- [release-branch.r57] png: speed up opaque RGBA encoding
00:58 < dfc> it is implicit
00:58 < plexdev> http://is.gd/JcePOd by [Russ Cox] in 2 subdirs of
go/src/pkg/ -- [release-branch.r57] runtime, sync/atomic: fix arm cas
00:58 < dfc> so, that is totally awesome
00:58 < plexdev> http://is.gd/oAKe9y by [Russ Cox] in 4 subdirs of
go/src/cmd/ -- [release-branch.r57] 5a, 6a, 8a, cc: remove old environment
variables
00:58 < Namegduf> It's useful for combining an arbitrary Reader and Writer
into a ReadWriter
00:58 < plexdev> http://is.gd/ejMK8i by [Russ Cox] in 2 subdirs of go/src/
-- [release-branch.r57] http/pprof: fix POST reading bug
00:58 < Namegduf> For a practical example
00:58 < plexdev> http://is.gd/00yggb by [Russ Cox] in 2 subdirs of
go/src/pkg/image/ -- [release-branch.r57] image: add type-specific Set methods and
use them when decoding PNG.
00:58 < dfc> gav
00:58 < plexdev> http://is.gd/ldJzTX by [Russ Cox] in go/src/pkg/image/ --
[release-branch.r57] image: fix build
00:58 < dfc> bloody tav's bot
00:58 < plexdev> http://is.gd/ergBKt by [Russ Cox] in go/doc/ --
[release-branch.r57] doc/install: specify clone -u instead of -r
00:58 < plexdev> http://is.gd/Ev0EuS by [Russ Cox] in go/src/pkg/image/jpeg/
-- [release-branch.r57] jpeg: speed up RGBA encoding ~%50
00:58 < plexdev> http://is.gd/F94W9X by [Russ Cox] in go/src/pkg/reflect/ --
[release-branch.r57] reflect: allow unexported key in Value.MapIndex
00:59 < tav> heh
00:59 < plexdev> http://is.gd/ThfLyZ by [Russ Cox] in go/src/ --
[release-branch.r57] Make.cmd: create TARGDIR if necessary
00:59 < plexdev> http://is.gd/GkU37R by [Russ Cox] in 2 subdirs of go/doc/
-- [release-branch.r57] doc: release.r57
00:59 < tav> sorry guys
00:59 < plexdev> http://is.gd/hwb4aE by [Russ Cox] in go/src/pkg/http/ --
[release-branch.r57] http: fix FormFile nil pointer dereference on missing
multipart form
00:59 < plexdev> http://is.gd/pEPD1Y by [Russ Cox] in go/doc/devel/ --
[release-branch.r57] doc: document r57.1
00:59 < plexdev> http://is.gd/YZQoMI by [Russ Cox] in go/lib/codereview/ --
create release-branch.r57
00:59 < plexdev> http://is.gd/A9OJHi by [Russ Cox] in go/src/pkg/xml/ --
[release-branch.r57] xml: fix reflect error
00:59 < plexdev> http://is.gd/ylHNSS by [Russ Cox] in 2 subdirs of
go/src/pkg/image/ -- [release-branch.r57] image: png & jpeg encoding benchmarks
00:59 -!- mikespook [~mikespook@183.47.225.90] has joined #go-nuts
00:59 < plexdev> http://is.gd/iNEPkr by [Russ Cox] in go/src/pkg/http/ --
[release-branch.r57] http: new error for reading a body after it's been closed
00:59 -!- plexdev [~plexdev@arthur.espians.com] has quit [Read error: Connection
reset by peer]
00:59 < tav> there =)
01:00 < dfc> and stay out
01:01 < dfc> :P
01:01 < tav> i've already updated the config
01:01 < ghais> reminds me of a scene in Bruce Almighty :)
01:01 < tav> it was meant to be useful, but sadly i've not been keeping up
with the various changes they keep making to the release/branch structure
01:02 < tav> anyways, there'll be no more spamming =)
01:02 < tav> sorry for all annoyances caused by the bot to date
01:04 -!- drteeth [~drteeth@173-230-160-81.cable.teksavvy.com] has joined #go-nuts
01:06 -!- orange_ [~drteeth@173-230-160-81.cable.teksavvy.com] has left #go-nuts
[]
01:07 -!- cafesofie [~cafesofie@ool-18b97779.dyn.optonline.net] has quit [Remote
host closed the connection]
01:08 <+iant> tav: thanks for running th ebot
01:08 <+iant> the bot
01:09 < tav> my pleasure — sorry for not having maintained it properly
through the various release/branch changes
01:11 < tav> iant and anyone else who might be around...
01:11 < tav> i was wondering if any of you could take a look at some go code
of mine before i deploy it in production....  ?
01:12 -!- drteeth [~drteeth@173-230-160-81.cable.teksavvy.com] has joined #go-nuts
01:12 -!- drteeth [~drteeth@173-230-160-81.cable.teksavvy.com] has left #go-nuts
[]
01:12 < tav> sadly, not knowing other go coders in real life, i have had
little chance for code reviews of go code =(
01:13 < dfc> tav, sorry for dumping on your bot
01:13 < dfc> it is useful
01:13 < dfc> except when releases happen
01:13 < dfc> then git spams it with heaps of changes
01:13 < dfc> i'm happy to offer to review code if you want someone to bounce
ideas off
01:13 < tav> dfc: no worries dude, i totally relate — hate bots which spam
=(
01:13 < tav> dfc: ah, thanks!
01:14 < tav> the main app is:
https://github.com/tav/togethr/blob/master/live-server/live-server.go
01:14 -!- xyproto [~alexander@77.40.159.131] has quit [Ping timeout: 276 seconds]
01:14 < tav> it uses just the standard library and a bunch of amp/ packages
which can be found inside src/go/ in the ampify repo,
e.g.https://github.com/tav/ampify/blob/master/src/go/livequery/livequery.go
01:15 -!- ttblrs_ [U2FsdGVkX1@order.stressinduktion.org] has joined #go-nuts
01:16 -!- elephants [~drteeth@173-230-160-81.cable.teksavvy.com] has joined
#go-nuts
01:16 < tav> urgh, e.g.
https://github.com/tav/ampify/blob/master/src/go/livequery/livequery.go even
01:16 < dfc> cool
01:16 -!- ttblrs [U2FsdGVkX1@order.stressinduktion.org] has quit [Ping timeout:
246 seconds]
01:16 -!- dlowe [~dlowe@ita4fw1.itasoftware.com] has quit [Ping timeout: 246
seconds]
01:16 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 246 seconds]
01:16 -!- prip [~foo@host33-131-dynamic.47-79-r.retail.telecomitalia.it] has quit
[Ping timeout: 246 seconds]
01:16 -!- mpl [~mpl@smgl.fr.eu.org] has quit [Ping timeout: 246 seconds]
01:16 < dfc> i'll take a look after work
01:16 < tav> thanks man, much appreciated!
01:16 -!- xyproto [~alexander@77.40.159.131] has joined #go-nuts
01:16 -!- mpl [~mpl@smgl.fr.eu.org] has joined #go-nuts
01:18 -!- dlowe [~dlowe@ita4fw1.itasoftware.com] has joined #go-nuts
01:18 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
01:27 -!- prip [~foo@host33-131-dynamic.47-79-r.retail.telecomitalia.it] has
joined #go-nuts
01:29 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
01:30 -!- fmoo [~Adium@66.220.144.74] has quit [Quit: Leaving.]
01:34 -!- sacho [~sacho@95-42-64-32.btc-net.bg] has quit [Ping timeout: 240
seconds]
01:35 -!- sacho [~sacho@79-100-48-20.btc-net.bg] has joined #go-nuts
01:59 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
02:00 -!- ezys [~ezys@c-67-161-85-212.hsd1.wa.comcast.net] has joined #go-nuts
02:05 -!- benjack [~benjack@bb121-6-49-43.singnet.com.sg] has joined #go-nuts
02:08 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
02:11 -!- ab3 [~abe@ip-83-134-140-45.dsl.scarlet.be] has quit [Ping timeout: 240
seconds]
02:16 -!- ghais [~ghais@c-68-32-79-77.hsd1.ga.comcast.net] has quit [Quit: ghais]
02:16 -!- scyth [~scyth@rots.in.rs] has joined #go-nuts
02:18 -!- gaxxx [~woo@219.143.166.16] has joined #go-nuts
02:19 -!- gaxxx [~woo@219.143.166.16] has quit [Client Quit]
02:20 -!- gaxxx [~woo@219.143.166.16] has joined #go-nuts
02:27 -!- l00t [~i-i3id3r_@189.105.102.222] has quit [Quit: Leaving]
02:35 -!- foocraft [~ewanas@78.101.69.106] has quit [Ping timeout: 240 seconds]
02:35 -!- foocraft [~ewanas@78.101.74.117] has joined #go-nuts
02:37 -!- gaxxx [~woo@219.143.166.16] has quit [Ping timeout: 276 seconds]
02:38 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 252 seconds]
02:38 -!- gaxxx [~woo@li119-190.members.linode.com] has joined #go-nuts
02:42 -!- crazy2be [~crazy2be@d209-89-248-73.abhsia.telus.net] has joined #go-nuts
02:47 < crazy2be> how would you structure a CMS that has the ability to
retreive certain objects/data strcutres by name?
02:47 < crazy2be> be they events, wiki pages, photos, etc
02:50 < crazy2be> i was thinking having a struct for each type, allow the
user to modify the struct, and then have a Save() method.  That part i'm fairly
sure of
02:50 -!- gaxxx [~woo@li119-190.members.linode.com] has quit [Ping timeout: 260
seconds]
02:51 < crazy2be> What i'm unsure of is the best way to structure loading
02:52 < crazy2be> i have one package that has a NewEvent() method that
returns a *Event, which you can then set the ID of and .Load()
02:52 < crazy2be> but that seems icky
02:53 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
02:53 < crazy2be> i was thinking of having a LoadEvent(id string) method,
rather than a NewEvent() method
02:53 -!- jhawk28 [~jhawk28@user-387c58d.cable.mindspring.com] has quit [Quit:
Linkinus - http://linkinus.com]
02:53 < crazy2be> yeah that's probably the best solution
02:53 < crazy2be> thanks!
02:58 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
02:59 -!- benjack1 [~benjack@bb119-74-241-182.singnet.com.sg] has joined #go-nuts
03:01 -!- benjack [~benjack@bb121-6-49-43.singnet.com.sg] has quit [Ping timeout:
250 seconds]
03:01 -!- keithcascio [~keithcasc@nat/google/x-nzhgnvoymsprqcbx] has quit [Quit:
Leaving]
03:10 < scyth> anyone knows how to get list of databases in mongod, through
mgo driver?
03:13 < scyth> nevermind, got it
03:13 -!- benjack1 [~benjack@bb119-74-241-182.singnet.com.sg] has quit [Quit:
Leaving.]
03:20 -!- gaxxx [~woo@219.143.166.16] has joined #go-nuts
03:22 -!- kr [~Keith@204.14.152.118] has joined #go-nuts
03:22 -!- telexicon [~telexicon@unaffiliated/chowmeined] has joined #go-nuts
03:27 < crazy2be> hmm i hate that go doesn't initialize pointers to objects
in named return values
03:32 -!- boscop__ [~boscop@g230103202.adsl.alicedsl.de] has joined #go-nuts
03:35 -!- boscop_ [~boscop@f055253036.adsl.alicedsl.de] has quit [Ping timeout:
248 seconds]
03:37 -!- meanburrito920 [~john@76-217-6-100.lightspeed.irvnca.sbcglobal.net] has
joined #go-nuts
03:37 -!- meanburrito920 [~john@76-217-6-100.lightspeed.irvnca.sbcglobal.net] has
quit [Changing host]
03:37 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has joined #go-nuts
03:46 -!- elephants [~drteeth@173-230-160-81.cable.teksavvy.com] has quit [Remote
host closed the connection]
03:49 < Namegduf> Pointers default to nil.
03:49 < Namegduf> Always.
03:51 < skelterjohn> crazy2be: what if you wanted to return an object that
had already been allocated?  if the return values were allocated automatically,
this would be a waste
03:52 -!- kr [~Keith@204.14.152.118] has quit [Quit: WeeChat 0.3.4]
03:52 < crazy2be> skelterjohn: True, and it shouldn't really allocate it
03:52 < crazy2be> it just keeps catching me
03:53 < crazy2be> e.g.  i have func NewFoo() (f *Foo) {f.Blar = ...}
03:53 < crazy2be> and i get confused with the nil pointer dereference until
i realize the issue
03:53 < crazy2be> more my fault than the compiler's, but it could pick that
up at compile-time
03:54 < crazy2be> since i'm attempting to assign to a pointer that it can
gaurentee is nil
03:54 < skelterjohn> a clever compiler might catch that one day
03:54 < crazy2be> 'twould be nice
03:54 < crazy2be> anyway night all
03:55 < crazy2be> er, s/assign/dereference
03:55 -!- crazy2be [~crazy2be@d209-89-248-73.abhsia.telus.net] has quit [Remote
host closed the connection]
04:04 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has quit [Ping
timeout: 276 seconds]
04:05 -!- tobym [~tobym@cpe-72-229-2-6.nyc.res.rr.com] has joined #go-nuts
04:15 -!- Viriix [~joseph@c-67-169-172-251.hsd1.ca.comcast.net] has joined
#go-nuts
04:16 -!- rejb [~rejb@unaffiliated/rejb] has quit [Disconnected by services]
04:17 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
04:33 -!- krutcha [~krutcha@S010600045a27676a.vs.shawcable.net] has joined
#go-nuts
04:49 -!- edsrzf [~edsrzf@122-61-221-144.jetstream.xtra.co.nz] has joined #go-nuts
04:54 -!- zozoR [~Morten@2906ds2-arno.0.fullrate.dk] has joined #go-nuts
05:11 -!- mikespook [~mikespook@183.47.225.90] has quit [Ping timeout: 276
seconds]
05:12 -!- TMKCodes [~TMKCodes@unaffiliated/tmkcodes] has quit [Ping timeout: 248
seconds]
05:15 -!- mikespook [~mikespook@183.47.225.90] has joined #go-nuts
05:16 -!- Viriix [~joseph@c-67-169-172-251.hsd1.ca.comcast.net] has left #go-nuts
["Leaving"]
05:17 -!- Bigbear1 [~Cody@d75-158-140-53.abhsia.telus.net] has joined #go-nuts
05:21 -!- vsayer [~vivek@c-67-170-236-166.hsd1.ca.comcast.net] has joined #go-nuts
05:32 -!- Border [~Border@114.246.88.217] has joined #go-nuts
05:32 -!- Border [~Border@114.246.88.217] has quit [Client Quit]
05:34 -!- tvw [~tv@e176001002.adsl.alicedsl.de] has joined #go-nuts
05:34 -!- Makoryu [~bloodgog@pool-71-174-191-10.bstnma.fios.verizon.net] has quit
[Read error: Connection reset by peer]
05:35 -!- Makoryu [~bloodgog@pool-71-174-191-10.bstnma.fios.verizon.net] has
joined #go-nuts
05:42 -!- yadaa [~yada@123.116.40.235] has joined #go-nuts
05:43 -!- tvw [~tv@e176001002.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
05:48 -!- Bigbear1 [~Cody@d75-158-140-53.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
05:49 -!- TMKCodes [~TMKCodes@unaffiliated/tmkcodes] has joined #go-nuts
05:50 -!- foocraft [~ewanas@78.101.74.117] has quit [Remote host closed the
connection]
05:53 -!- tvw [~tv@e176001002.adsl.alicedsl.de] has joined #go-nuts
05:58 -!- thgrtuy [~thgrtuy@208-191-152-69.lightspeed.austtx.sbcglobal.net] has
quit [Quit: leaving]
06:05 -!- TMKCodess [~TMKCodes@bbwirelessgw2-fee1dc00-62.dhcp.inet.fi] has joined
#go-nuts
06:05 -!- TMKCodess [~TMKCodes@bbwirelessgw2-fee1dc00-62.dhcp.inet.fi] has quit
[Changing host]
06:05 -!- TMKCodess [~TMKCodes@unaffiliated/tmkcodes] has joined #go-nuts
06:07 < scyth> with json txt like this: {"key1": [ "item1": 4], "key2": [
"item2": 5], }, what would be the appropriate struct type in go?
06:07 < scyth> for Unmarshal
06:07 < taruti> how did I dump the assembler output with 8g?
06:07 < edsrzf> scyth: There's no one type that will work
06:08 -!- foocraft [~ewanas@78.101.74.117] has joined #go-nuts
06:09 < edsrzf> One possibility would be struct{Key1 struct{Item1 int
"item1"} "key1"; Key2 struct{Item2 int "item2"}}
06:09 < edsrzf> taruti: 8g -S
06:11 < scyth> edsrzf, why not type MyType struct{ Data map[string][]*Items
} where Items struct is { map[string]int }
06:12 < scyth> or something like that
06:12 -!- alexandere [~alexander@eijg.xs4all.nl] has quit [Quit: alexandere]
06:13 < edsrzf> scyth: The struct has to have at least two fields because
the json dictionary has two
06:14 < edsrzf> Or you could just use a map directly and bypass the struct
altogether.
06:14 < scyth> yeah
06:14 < taruti> edsrzf: thanks
06:16 -!- sebastianskejoe [~sebastian@188.114.142.217] has joined #go-nuts
06:20 -!- zozoR [~Morten@2906ds2-arno.0.fullrate.dk] has quit [Ping timeout: 258
seconds]
06:21 -!- alexandere [~alexander@eijg.xs4all.nl] has joined #go-nuts
06:27 -!- iant [~iant@216.239.45.130] has quit [Ping timeout: 260 seconds]
06:28 -!- petrux [~petrux@host16-224-static.53-82-b.business.telecomitalia.it] has
joined #go-nuts
06:29 -!- genbattle [~nick@203-173-210-96.dialup.ihug.co.nz] has joined #go-nuts
06:32 -!- wrtp [~rog@92.17.111.113] has joined #go-nuts
06:33 -!- bortzmeyer [~bortzmeye@batilda.nic.fr] has joined #go-nuts
06:34 < taruti> Is there a constant on the number of bits int has?
06:35 -!- Viriix [~joseph@c-67-169-172-251.hsd1.ca.comcast.net] has joined
#go-nuts
06:35 < dfc> no
06:35 < dfc> int is 32 on 32bit platforms, 64 on amd64
06:36 -!- ExtraSpice [XtraSpice@88.118.35.153] has joined #go-nuts
06:36 < taruti> dfc: I mean somewhere in the source const IntBits =
<whatever>
06:37 < taruti> rather than having to use reflect.TypeOf(0).Bits()
06:37 < uriel> I thought int was still the same in all platforms, but it
might change in the future
06:38 < uriel> taruti: why do you need to do that?  just use an integer with
specified size
06:38 < taruti> uriel: yes (reflect crashes on me in this case probably
related to package initialization order and I need to circumvent this)
06:44 < dfc> taruti: ahh, sorry, nope, not sure
06:44 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-156-86.clienti.tiscali.it] has
joined #go-nuts
06:46 -!- iant [~iant@216.239.45.130] has joined #go-nuts
06:46 -!- mode/#go-nuts [+v iant] by ChanServ
06:46 -!- napsy [~luka@88.200.96.18] has quit [Quit: Lost terminal]
06:47 -!- krutcha [~krutcha@S010600045a27676a.vs.shawcable.net] has quit [Quit:
Leaving]
06:50 -!- tylerl [~tylerl@ip24-251-232-171.ph.ph.cox.net] has joined #go-nuts
06:51 -!- htoothrot [~mux@66-169-185-121.dhcp.ftwo.tx.charter.com] has quit [Ping
timeout: 248 seconds]
06:52 -!- htoothrot [~mux@66-169-185-121.dhcp.ftwo.tx.charter.com] has joined
#go-nuts
06:52 -!- sacho [~sacho@79-100-48-20.btc-net.bg] has quit [Read error: Connection
reset by peer]
06:53 -!- Boney [~paul@124-168-103-51.dyn.iinet.net.au] has quit [Ping timeout:
240 seconds]
06:54 -!- Boney [~paul@124-168-103-51.dyn.iinet.net.au] has joined #go-nuts
06:57 -!- Stiletto [7f000001@69.195.144.4] has quit [Ping timeout: 240 seconds]
07:07 -!- yadaa [~yada@123.116.40.235] has left #go-nuts []
07:13 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
07:15 -!- Stiletto [7f000001@69.195.144.4] has joined #go-nuts
07:16 -!- chickamade [~chickamad@115.78.135.244] has joined #go-nuts
07:26 -!- Cobi [~Cobi@2002:1828:88fb:0:aede:48ff:febe:ef03] has quit [Ping
timeout: 260 seconds]
07:32 -!- alexandere [~alexander@eijg.xs4all.nl] has quit [Quit: alexandere]
07:39 -!- tylerl [~tylerl@ip24-251-232-171.ph.ph.cox.net] has quit [Quit: leaving]
07:41 -!- dfc [~dfc@eth59-167-133-99.static.internode.on.net] has quit [Ping
timeout: 240 seconds]
07:44 -!- Cobi [~Cobi@2002:1828:88fb:0:aede:48ff:febe:ef03] has joined #go-nuts
07:51 -!- viirya [~viirya@cml506-25.csie.ntu.edu.tw] has quit [Ping timeout: 260
seconds]
07:56 -!- TMKCodess [~TMKCodes@unaffiliated/tmkcodes] has quit [Quit: Leaving]
08:03 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-156-86.clienti.tiscali.it] has
quit [Read error: Connection reset by peer]
08:05 -!- Makoryu [~bloodgog@pool-71-174-191-10.bstnma.fios.verizon.net] has quit
[Remote host closed the connection]
08:06 -!- genbattle [~nick@203-173-210-96.dialup.ihug.co.nz] has quit [Ping
timeout: 248 seconds]
08:09 -!- viirya [~viirya@cml506-25.csie.ntu.edu.tw] has joined #go-nuts
08:09 -!- blackmagik [~blackmagi@unaffiliated/blackmagik] has joined #go-nuts
08:13 -!- cromartie-x182 [~cromartie@24.229.243.68.res-cmts.sm.ptd.net] has joined
#go-nuts
08:13 -!- cromartie-x182 [~cromartie@24.229.243.68.res-cmts.sm.ptd.net] has left
#go-nuts []
08:14 -!- ctimmerm [~ctimmerm@83.150.80.193] has joined #go-nuts
08:16 -!- icy [~icy@lighttpd/icy] has joined #go-nuts
08:17 < icy> does the gc give back memory to the OS nowerdays?  I only know
it didn't do that before and couldn't find a ticket for that
08:19 -!- foocraft [~ewanas@78.101.74.117] has quit [Quit: Leaving]
08:22 -!- Viriix [~joseph@c-67-169-172-251.hsd1.ca.comcast.net] has left #go-nuts
["Leaving"]
08:25 < edsrzf> icy: I don't think it does
08:43 < uriel> most GCs don't return memory to the OS once allocated
08:54 -!- chickamade [~chickamad@115.78.135.244] has quit [Quit: chickamade]
08:55 -!- chickamade [~chickamad@115.78.135.244] has joined #go-nuts
08:56 -!- chickamade [~chickamad@115.78.135.244] has quit [Client Quit]
08:58 < mpl> I'm having an issue while reading a part from a multipart http
(uploaded file).  on one machine what I did works without a problem, on the other
one I get unexpected EOF at various times depending on the uploaded file.  same
code on both machines, same go tree (weekly-24/04).  any idea please?
08:59 < mpl> code does something similar to this: http://pastie.org/1870951
09:04 < nictuku> mpl, the only idea I have is suggesting you to looking at
the HTTP session conversation with wireshark or tcpdump
09:07 < edsrzf> mpl: I think there have been several fixes to that code
recently
09:07 < edsrzf> I haven't paid attention to what exactly the bugs were, but
I recommend updating.
09:08 < icy> uriel: yea, that's why I stay with C for a bunch of things :)
09:08 < icy> or at least one of the reasons
09:09 < wrtp> icy: C often doesn't return memory to the OS either, unless
you use brk directly
09:09 < mpl> edsrzf: yah, I see Read on a Part now returns an EOF in the
latest changes
09:09 < mpl> gonna update and see.
09:10 < icy> wrtp: C doesn't do anything at all with memory, the allocator
does and I can control that one
09:10 < mpl> I'm just puzzled as to why I have two different behaviour on
the 2 machines while it's the same code, same go version, and same testing
"protocol".
09:11 < wrtp> icy: depends if you're using external libraries or not.
09:11 < icy> wrtp: for example using mmap can be extremely useful
09:11 < wrtp> icy: you can use mmap in go
09:12 < icy> hm yea it has a syscall package
09:13 < wrtp> see, for example http://goneat.org/pkg/launchpad.net/gommap/
09:13 < edsrzf> Or https://github.com/edsrzf/mmap-go ;)
09:14 -!- ognom [ognom@c-bef570d5.033-10-67626721.cust.bredbandsbolaget.se] has
quit [Quit: leaving]
09:19 -!- madari [madari@idm.irc-galleria.net] has quit [Ping timeout: 240
seconds]
09:24 -!- nictuku [~yvesj@unaffiliated/nictuku] has quit [Ping timeout: 276
seconds]
09:24 < xyproto> s = s + x can be written as s += x, but what if you wanted
to express s = x + s?  += for prepending is missing ;)
09:27 -!- Kafo [5b98bdf4@gateway/web/freenode/ip.91.152.189.244] has joined
#go-nuts
09:29 < mpl> edsrzf: yep that was it.  they had broken something related to
reading parts and they fixed it afterwards.  still don't know why the problem
wasn't showing on the other machine though.
09:30 -!- djcapelis [~djc@blender/coder/DJCapelis] has quit [Ping timeout: 240
seconds]
09:31 -!- djcapelis [~djc@capelis.dj] has joined #go-nuts
09:31 -!- djcapelis [~djc@capelis.dj] has quit [Changing host]
09:31 -!- djcapelis [~djc@blender/coder/DJCapelis] has joined #go-nuts
09:32 -!- mikespook [~mikespook@183.47.225.90] has quit [Quit: Leaving.]
09:35 -!- piranha [~piranha@5ED42E59.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
09:39 -!- nictuku [~yvesj@84-72-7-79.dclient.hispeed.ch] has joined #go-nuts
09:39 -!- nictuku [~yvesj@84-72-7-79.dclient.hispeed.ch] has quit [Changing host]
09:39 -!- nictuku [~yvesj@unaffiliated/nictuku] has joined #go-nuts
09:43 -!- blackmagik [~blackmagi@unaffiliated/blackmagik] has quit [Ping timeout:
264 seconds]
09:44 -!- GeertJohan [~Squarc@ip4da06866.direct-adsl.nl] has joined #go-nuts
09:48 < wrtp> could someone please try cd $GOROOT/misc/cgo/test; make
09:48 < wrtp> it fails on my machine, but i'm not sure if it's because of
some local changes i've made
09:49 < wrtp> i think i've reverted my changes, but now i'm paranoid...
09:51 -!- shvntr [~shvntr@116.26.139.12] has joined #go-nuts
09:53 -!- ctimmerm [~ctimmerm@83.150.80.193] has quit [Quit: ctimmerm]
09:54 -!- foocraft [~ewanas@78.101.74.117] has joined #go-nuts
10:00 -!- KrakensDen [~krakensde@li221-186.members.linode.com] has quit [Ping
timeout: 240 seconds]
10:00 -!- rphillips [~rphillips@unaffiliated/rphillips] has quit [Ping timeout:
248 seconds]
10:00 -!- adg [~nf@2001:470:21:20::4444:61d9] has quit [Ping timeout: 260 seconds]
10:00 -!- kuroneko [~chris@yayoi.xware.cx] has quit [Ping timeout: 240 seconds]
10:00 -!- drhodes [~none@drhodes.xen.prgmr.com] has quit [Ping timeout: 240
seconds]
10:00 -!- zanget [~zanget@hurf.durf.me] has quit [Ping timeout: 240 seconds]
10:00 -!- xulfer [~xulfer@cheapbsd.net] has quit [Ping timeout: 276 seconds]
10:09 < wrtp> it's ok - i think it's only designed to be used with gotest
10:10 -!- tvw [~tv@e176001002.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
10:12 -!- madari [madari@idm.irc-galleria.net] has joined #go-nuts
10:34 -!- gaxxx [~woo@219.143.166.16] has quit [Remote host closed the connection]
10:44 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-156-86.clienti.tiscali.it] has
joined #go-nuts
10:45 -!- ios_ [~ios@180.191.138.218] has joined #go-nuts
10:48 -!- rejb [~rejb@unaffiliated/rejb] has quit [Quit: .]
10:56 -!- genbattle [~nick@203-173-210-96.dialup.ihug.co.nz] has joined #go-nuts
10:57 -!- genbattle [~nick@203-173-210-96.dialup.ihug.co.nz] has quit [Client
Quit]
10:57 -!- genbattle [~nick@203-173-210-96.dialup.ihug.co.nz] has joined #go-nuts
10:58 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 260 seconds]
10:59 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
11:03 -!- ghais [~ghais@c-68-32-79-77.hsd1.ga.comcast.net] has joined #go-nuts
11:03 -!- ghais [~ghais@c-68-32-79-77.hsd1.ga.comcast.net] has quit [Client Quit]
11:04 -!- GeneralMaximus [~general@122.173.196.140] has joined #go-nuts
11:09 -!- edsrzf [~edsrzf@122-61-221-144.jetstream.xtra.co.nz] has quit [Remote
host closed the connection]
11:11 * wrtp just managed to get go to create a native mac os window.  woo.
11:15 < nictuku> wrtp, congrats!
11:20 < genbattle> anyone know anything about creating c-style memory blocks
to pass into c functions in cgo?
11:21 < genbattle> so far i've been trying to fiddle with using C.malloc(),
make() and unsafe.NewArray()
11:23 < genbattle> in C i'm doing "*platforms = malloc(num_platforms *
sizeof(cl_platform_id));" but i can't figure out what the equivalent cgo is
11:26 < wrtp> genbattle: you have to cast the return from C.malloc to the
correct type
11:30 < genbattle> the main problem i'm having using C.malloc() is that i
can't figure out how to get sizeof()
11:30 < genbattle> C.sizeof() doesn't seem to work
11:32 < genbattle> my cgo line is platform_ids :=
C.malloc(C.sizeof(C.cl_platform_id) * int(num_platforms)), and i get the error
"cl.go:38:27: call of non-function C.sizeof"
11:33 -!- ab3 [~abe@ip-83-134-140-45.dsl.scarlet.be] has joined #go-nuts
11:34 < genbattle> any other helpful hint wrtp?
11:36 -!- adg [~nf@2001:470:21:20::4444:61d9] has joined #go-nuts
11:36 -!- mode/#go-nuts [+o adg] by ChanServ
11:37 -!- drhodes [~none@drhodes.xen.prgmr.com] has joined #go-nuts
11:38 < wrtp> genbattle: you can probably use unsafe.Sizeof
11:38 < genbattle> already tried that one
11:38 < genbattle> cl.go:22[_obj/cl.cgo1.go:25]: type
_Ctypedef_cl_platform_id is not an expression
11:38 < genbattle> i think it's meant for use on Go types
11:39 < wrtp> hmm, hold on, i'll have a try
11:39 < genbattle> although you would think it would work on c types too
11:39 -!- rphillips [~rphillips@unaffiliated/rphillips] has joined #go-nuts
11:42 < wrtp> genbattle: it does
11:42 < wrtp> but...
11:42 < genbattle> i make some progress by using
C.Sizeof(new(C.cl_platform_id))
11:42 < wrtp> yeah
11:42 < genbattle> but?
11:43 < wrtp> or just use a global variable of the right type
11:43 < genbattle> it seems the go version only measures the size of actual
variables, instead of types
11:43 < genbattle> oh well
11:43 < wrtp> i was just about to say that
11:43 < wrtp> yes
11:43 < wrtp> it's just a normal function
11:43 < genbattle> ok
11:43 < wrtp> well, not that normal, because the compiler implements it
11:43 < wrtp> and doesn't actually evaluate the expression
11:43 < wrtp> i don't think
11:44 < wrtp> if in doubt, just create a little C function to do your dirty
work for you
11:46 < genbattle> heh
11:46 < genbattle> fortunately i managed to solve the problem with your help
:)
11:47 < genbattle> platform_ids :=
(*C.cl_platform_id)(C.malloc(C.size_t(unsafe.Sizeof(new(C.cl_platform_id)) *
int(num_platforms))))
11:47 < genbattle> seems to produce the equivalent memory allocation
11:47 < genbattle> even if it is a little messy
11:52 -!- artefon [~thiago@189.59.134.193] has joined #go-nuts
11:52 < wrtp> cl_platform_id* new_ids(int n) { return
malloc(sizeof(cl_platform_id) * n); }
11:53 < wrtp> do as much messy stuff as you can in C :-)
11:55 < genbattle> heh
11:55 < genbattle> just don't want to create yet another layer of C to
interface to
11:56 < genbattle> my C skills are pretty second rate :P
11:57 -!- tvw [~tv@212.79.9.150] has joined #go-nuts
11:57 -!- foocraft [~ewanas@78.101.74.117] has quit [Ping timeout: 240 seconds]
11:57 -!- foocraft [~ewanas@78.100.222.158] has joined #go-nuts
11:58 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Quit:
Leaving.]
11:59 -!- telexicon [~telexicon@unaffiliated/chowmeined] has quit [Ping timeout:
252 seconds]
12:01 < GeertJohan> humz updating(hg pull; hg update release; ./all.bash)
fails, TEST FAIL http..
12:01 < GeertJohan> any thoughts?
12:02 -!- ios_ [~ios@180.191.138.218] has quit [Quit: Leaving]
12:02 < GeertJohan> --- FAIL: http_test.TestSetsRemoteAddr (0.00 seconds)
12:02 < GeertJohan> Expected local addr; got "192.168.2.22:45233"
12:03 < GeertJohan> while '192.168.2.22' IS actually my wlan0 ip address
12:06 -!- niemeyer [~niemeyer@200-102-196-125.pltce701.dsl.brasiltelecom.net.br]
has joined #go-nuts
12:07 < genbattle> wrtp: sorry to bug you again, but now that i've got a C
memory block, do you know how i would go about accessing it in cgo?
12:07 < genbattle> since i can't do pointer arithmetic
12:07 < genbattle> i'm guessing there's some more complex casting involved
to be able to index the individual memory addresses?
12:09 < nictuku> argh, the way to do sub-type method overriding is very
unintuitive.
12:10 < genbattle> sub-type?
12:11 < genbattle> how do you get a sub type without inheritance
hierarchies, i don't understand?
12:11 < nictuku> it's possible:
http://golang.org/doc/go_for_cpp_programmers.html#Interfaces
12:11 < nictuku> search for "anonymous"
12:13 < genbattle> hmmm, interesting
12:13 < genbattle> but then can't you override by simply not inheriting?
12:13 < genbattle> because you have to explicitly inherit methods, right?
12:13 < wrtp> nictuku: if you're finding something unintuitive, you're
probably going about it the wrong way...
12:14 < genbattle> maybe i'm not understanding it correctly
12:14 < wrtp> genbattle: you can cast it to a go array
12:15 < wrtp> rather, a pointer to a go array
12:15 < genbattle> ok
12:15 < genbattle> thanks
12:15 < wrtp> then you can slice the array to the correct size
12:16 < nictuku> wrtp, that's very nice of you, to assume I'm doing it wrong
;-)
12:16 < wrtp> nictuku: go doesn't do subtyping
12:16 < nictuku> wrtp, ??
12:17 < nictuku> it does, in a way.  See the link above.
12:17 < wrtp> so if you're talking about subtype method overriding, there's
something wrong :-)
12:17 < wrtp> go does embedding
12:18 < wrtp> and interfaces
12:18 < nictuku> wrtp, I have a specific need of doing method overriding.
And it would be nicer of you to stop assuming I don't know what I'm talking about.
12:19 -!- virtualsue [~chatzilla@nat/cisco/x-lkzkjvoguphckqjh] has joined #go-nuts
12:19 < wrtp> describe what your need is, and maybe we can help.
12:20 < nictuku> wrtp, I didn't ask for help.
12:21 < wrtp> sure, but you implied that you were finding something awkward
12:21 < wrtp> go is not usually awkward...
12:23 < wrtp> anyway, if you want to create a type with one method changed,
i'd say that's fairly intuitive and straightforward
12:23 < wrtp> type myType struct {otherType}; func (t myType) Override() {}
12:24 < nictuku> I stated my opinion, not a fact.  We don't have to have the
same opinion.
12:24 < wrtp> sure.
12:24 < wrtp> but out of interest, what do you find unintuitive about the
above idiom?
12:26 < wrtp> genbattle: e.g.  slice :=
(*[1e9]C.cl_platform_id(platform_ids))[0:num_platforms]
12:27 < wrtp> genbattle: note the "large enough" array size
12:27 < nictuku> the fact that having an anonymous field implies parenthood.
12:27 < genbattle> wrtp: thanks
12:28 < wrtp> nictuku: it doesn't imply parenthood - it implies inclusion,
which is a bit different.
12:30 < wrtp> we don't have parents and children in Go - we have
relationships :-)
12:31 < nictuku> wrtp, that might be clear for you, but not for everyone.
And the document even keeps using the word 'inherit'.  So it's not just me that
associates this with inheritance.
12:33 < wrtp> it's true that there's one sentence in that document where it
should probably use "include" rather than "inherit"
12:33 < wrtp> the other one is talking explicitly about its relationship to
C++ classes
12:34 -!- PJRobins [~kvirc@184-100-100-163.mpls.qwest.net] has quit [Remote host
closed the connection]
12:34 < nictuku> wrtp, instead of accepting that my point is valid, you
prefer to think the document is wrong ;-)
12:34 < wrtp> one paragraph, actually.  "The set method is effectively
inherited from..."
12:35 < wrtp> nictuku: go doesn't do inheritance :-)
12:35 -!- PJRobins [~kvirc@184-100-100-163.mpls.qwest.net] has joined #go-nuts
12:35 < nictuku> wrtp, why do you keep saying that?
12:35 < wrtp> cos it's true?
12:35 < nictuku> "defining set and get for *myType made *myType
automatically inherit from myInterface."
12:36 < wrtp> in the same sentence before, it says "if we view myInterface
as a C++ pure abstract base class"
12:36 < wrtp> so, if we view it like that, sure, you can see it as
inheritance
12:36 < genbattle> nictuku: a struct doesn't inherit from an interface, it
implements it
12:36 < wrtp> it's an analogy
12:37 < wrtp> but it's not a particularly strong analogy
12:37 * nictuku will never rant on this channel anymore
12:37 -!- zerosanity [~josh@8.20.178.82] has joined #go-nuts
12:38 < wrtp> nictuku: you were ranting about one of the things that (i
believe) is strongest about the language.  it's not too surprising you got a
response.
12:41 < nictuku> I've been using the language for years, and I think it's
healthy to criticize it.  I respect your opinion that Go is never awkward but I
don't agree.  This is one other awkwardness in the syntax.
12:41 < nictuku> along with "delete a map entry" and others.
12:42 -!- Tasser [~freak@subtle/contributor/Tass] has joined #go-nuts
12:42 < genbattle> don't forget type switches :-[
12:42 -!- plainhao [~plainhao@208.75.85.237] has joined #go-nuts
12:42 < nictuku> genbattle, I don't mind those ;-)
12:43 < genbattle> anyway time for bed for me, thanks for the help wrtp,
night all
12:44 -!- genbattle [~nick@203-173-210-96.dialup.ihug.co.nz] has quit [Quit:
Leaving]
12:45 < nictuku> now, I do need a help.
12:46 < Tasser> hm, the Tree Comparison fails due to compile error (go
playground)
12:46 < wrtp> Tasser: what Tree Comparison?
12:46 < nictuku> oh, can I do sub-interfaces?  type foo interface { bar;
ExtraMethod() } ?
12:46 < wrtp> nictuku: yes
12:46 < nictuku> that's gonna help.  thanks wrtp
12:47 < wrtp> although they're less hierarchical than including anonymous
struct members
12:48 < wrtp> i've come to the conclusion that it's not usually worth using
them like that
12:48 < wrtp> better to have interfaces composed entirely of other
interfaces *or* of methods
12:49 < wrtp> otherwise there's no way of getting access to the interface
type for ExtraMethod() on its own
12:49 < wrtp> which is just fine for local types
12:49 < wrtp> but probably not something you want to export
12:52 < nictuku> good point
12:54 < Tasser> wrtp, http://golang.org/ - Example Tree Comparison
12:54 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
12:59 < wrtp> Tasser: try this instead: http://pastebin.com/AnU75Bn4
13:01 < wrtp> unfortunately it doesn't seem as if the examples are in the
repository, so i can't generate a fix
13:01 < wrtp> (the built in function closed was removed from the language
recently)
13:02 -!- shvntr [~shvntr@116.26.139.12] has quit [Quit: leaving]
13:03 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
13:03 -!- GeertJohan [~Squarc@ip4da06866.direct-adsl.nl] has quit [Quit: Leaving.]
13:06 < skelterjohn> morning
13:06 < Tasser> How would you build a large string from templates if you
can't modify strings?  push them into an array and concat that one in the end?
13:07 < skelterjohn> use []byte
13:07 < skelterjohn> you can modify them, and you can use bytes.Buffer to
build them
13:07 < skelterjohn> a bytes.Buffer is a Writer, so you can pass one to
template.Execute
13:08 < wrtp> skelterjohn: i managed to get Go to create a mac window...
13:09 < skelterjohn> cool - link?
13:09 < wrtp> not yet
13:09 < wrtp> it's a bit awkward because you can't directly link against
objective C
13:10 < wrtp> although i managed to get cgo to compile it
13:10 < wrtp> but you can link against a dynamic library that then uses
objective C
13:11 < skelterjohn> right - my intention was to make such a thing and then
also include some C functions in that library
13:11 < wrtp> which isn't ideal because you'll have to distribute the
dynamic library as well as the binary, but it's a start
13:11 -!- GeertJohan [~Squarc@ip4da06866.direct-adsl.nl] has joined #go-nuts
13:11 < GeertJohan> Can anyone help me with this please:
http://pastebin.com/JyWPhSdj
13:12 < GeertJohan> compiling go fails on test http
13:12 < xyproto> GeertJohan: looking at it
13:14 < GeertJohan> xyproto: thanks!  I think most of the interesting stuff
is at the last 20 lines...  first it gave an error that it had 192.168.2.22 (my
wlan ip) so I thought, maybe the test expects a 192.168.1.* as "local" address..
but now I set that on my eth0 device, still doesnt work...  so what is the "local"
address it requires for the test to pass?
13:14 < wrtp> GeertJohan: i thought you were able set DISABLE_NET_TESTS
13:15 < wrtp> but that's been removed
13:15 < GeertJohan> this build used to work before (older revision though)
on this same device
13:15 < wrtp> looks like a bug to me
13:15 < wrtp> i'd raise an issue
13:15 < skelterjohn> wrtp it has been replaced
13:15 < skelterjohn> something like
13:15 < skelterjohn> DISABLED_TEST=net
13:15 < skelterjohn> i forget what exactly
13:15 < wrtp> i grepped for disabled and didn't find anything
13:15 < skelterjohn> *something* like that
13:15 < skelterjohn> might not include that word
13:15 < GeertJohan> okay
13:16 < GeertJohan> well I think I'll raise an issue then, cause I cant find
anything about this on the #go-nuts google group either..
13:16 < GeertJohan> and all google search give's me is the source for the
test..
13:17 < wrtp> skelterjohn: CL 4429041 didn't seem to replace it with
anything else
13:18 < skelterjohn> i swear i saw a post about this
13:19 < GeertJohan> skelterjohn: did you maybe see me asking this same
question an hour ago?
13:20 < skelterjohn> no
13:20 < skelterjohn> i was asleep
13:20 < skelterjohn> i'm thinking of something from earlier this week
13:20 < GeertJohan> oh
13:20 < GeertJohan> at google groups ?
13:20 < skelterjohn> yes
13:20 < GeertJohan> searching agian
13:21 < GeertJohan> I do find stuff about test net
13:22 < GeertJohan> but I don't even get to net, it fails at http
13:22 < skelterjohn> that's the problem that DISABLE_NET_TEST addressed
13:22 < skelterjohn> something to do with web proxies
13:22 < skelterjohn> btw you can skip the tests entirely by running
make.bash instead
13:22 < skelterjohn> if you just want to get up off the ground
13:22 < GeertJohan> ohkay
13:22 < GeertJohan> I'll do that then :D
13:23 < GeertJohan> there :)
13:23 -!- melter [~Melter@2001:4930:116:0:21c:c0ff:feef:eaf5] has joined #go-nuts
13:23 < GeertJohan> now lets hope I get gocode to compile too
13:23 < GeertJohan> last revision didn't work with latest version of go..
13:25 < wrtp> GeertJohan: by the time your test has failed, all of go is
installed and (mostly) working
13:26 < GeertJohan> ohk
13:29 -!- iant [~iant@216.239.45.130] has quit [Ping timeout: 240 seconds]
13:30 -!- pharris [~Adium@rhgw.opentext.com] has joined #go-nuts
13:31 -!- GeneralMaximus [~general@122.173.196.140] has quit [Quit: Computer has
gone to sleep.]
13:33 < GeertJohan> hmmm gocode did compile and install, but when using
eclipse+goclipse the ide feezes directly when I place a dot after "fmt"..  seems
instable :P
13:35 -!- Fish [~Fish@exo3753.pck.nerim.net] has quit [Quit: So Long, and Thanks
for All the Fish]
13:35 < GeertJohan> unless I run `gocode -s` in the GOROOT XD
13:38 -!- rlab [~Miranda@91.200.158.34] has quit [Ping timeout: 240 seconds]
13:39 -!- Fish [~Fish@exo3753.pck.nerim.net] has joined #go-nuts
13:41 -!- iant [~iant@67.218.107.213] has joined #go-nuts
13:41 -!- mode/#go-nuts [+v iant] by ChanServ
13:41 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
13:42 -!- arun_ [~arun@i172010.upc-i.chello.nl] has quit [Ping timeout: 240
seconds]
13:43 < electro> I have a function with (extentList *[]Extent) as
inparamenter, now i would like to append to that slice
13:43 < electro> ive tried most variations and i cant figure it out
13:43 < electro> extentList = append(&extentList, extent)
13:43 < electro> src/image.go:200: cannot slice extentList (type *[]Extent)
13:43 < skelterjohn> *extendList = append(*extentList, extent)
13:44 < skelterjohn> until you dereference it, it's a pointer, not a slice
13:44 < electro> oh, that worked
13:44 < electro> thank you
13:45 < electro> since compiler whined about the slices i assumed the error
was the the right
13:50 -!- prudhvi [~prudhvi@look.ma.i.am.on.ipv6.at.prudhvi.de] has joined
#go-nuts
13:50 -!- iant [~iant@67.218.107.213] has quit [Ping timeout: 248 seconds]
13:51 -!- iant [~iant@216.239.45.130] has joined #go-nuts
13:51 -!- mode/#go-nuts [+v iant] by ChanServ
13:54 < jeremy_c> Is there a way in a slice to state end -1?  i.e.
mystring[5:-1] ...  doesn't work, slice required uint.  any other way besides
using len() ?
13:55 < skelterjohn> use len
13:55 < jeremy_c> skelterjohn: k, that's kinda what I figured.
13:56 -!- meanburrito920 [~john@76.217.6.100] has joined #go-nuts
13:56 -!- meanburrito920 [~john@76.217.6.100] has quit [Changing host]
13:56 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has joined #go-nuts
13:56 < wrtp> jeremy_c: it's because using negative offsets is error prone
13:57 < wrtp> (it can lead to hard-to-find bugs, instead of a quick panic)
13:57 < jeremy_c> wrtp: go does do quite a few things to prevent silly
errors.
13:57 < skelterjohn> not including a feature is a fairly passive way to
prevent errors :)
14:01 -!- arun_ [~arun@unaffiliated/sindian] has joined #go-nuts
14:04 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has quit [Ping
timeout: 258 seconds]
14:11 -!- Venom_X [~pjacobs@75-27-133-72.lightspeed.austtx.sbcglobal.net] has
joined #go-nuts
14:13 -!- pearle [~pearle@blk-224-181-222.eastlink.ca] has joined #go-nuts
14:15 < mpl> skelterjohn: and yet, an efficient way :)
14:16 -!- imsplitbit [~imsplitbi@64.39.4.132] has joined #go-nuts
14:18 -!- tobym [~tobym@cpe-72-229-2-6.nyc.res.rr.com] has quit [Ping timeout: 246
seconds]
14:24 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
14:28 -!- ExtraSpice [XtraSpice@88.118.35.153] has quit [Remote host closed the
connection]
14:38 -!- jbooth1 [~jay@209.249.216.2] has joined #go-nuts
14:43 -!- meanburrito920 [~john@76-217-6-100.lightspeed.irvnca.sbcglobal.net] has
joined #go-nuts
14:43 -!- meanburrito920 [~john@76-217-6-100.lightspeed.irvnca.sbcglobal.net] has
quit [Changing host]
14:43 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has joined #go-nuts
14:52 -!- awidegreen [~quassel@h-170-226.A212.priv.bahnhof.se] has joined #go-nuts
14:56 -!- rlab [~Miranda@91.200.158.34] has quit [Ping timeout: 276 seconds]
14:59 -!- ab3 [~abe@ip-83-134-140-45.dsl.scarlet.be] has quit [Ping timeout: 260
seconds]
14:59 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
14:59 -!- iant [~iant@216.239.45.130] has quit [Ping timeout: 260 seconds]
15:03 -!- awidegreen [~quassel@h-170-226.A212.priv.bahnhof.se] has quit [Remote
host closed the connection]
15:04 -!- petrux [~petrux@host16-224-static.53-82-b.business.telecomitalia.it] has
quit [Quit: leaving]
15:04 -!- awidegreen [~quassel@h-170-226.A212.priv.bahnhof.se] has joined #go-nuts
15:07 -!- iant [~iant@nat/google/x-infitzhfobqmanmn] has joined #go-nuts
15:07 -!- mode/#go-nuts [+v iant] by ChanServ
15:08 -!- rm445_ [rm445@pip.srcf.societies.cam.ac.uk] has quit [K-Lined]
15:15 -!- piranha [~piranha@5ED42E59.cm-7-5a.dynamic.ziggo.nl] has quit [Ping
timeout: 240 seconds]
15:20 -!- bortzmeyer [~bortzmeye@batilda.nic.fr] has quit [Quit: Leaving.]
15:21 -!- piranha [~piranha@5ED42E59.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
15:23 -!- artefon [~thiago@189.59.134.193] has quit [Quit: bye]
15:26 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
15:27 < GeertJohan> goroutines stop executing if main() is finished ?
15:27 < aiju> yes
15:27 < GeertJohan> okay, so I put this in the end of main():
15:28 < GeertJohan> time.Sleep(9223372036854775807)
15:28 < GeertJohan> fmt.Println("done");
15:28 < GeertJohan> but, I get done with almost no delay..  I should wait
over 200 years before I get to see done..
15:28 < aiju> lol
15:28 < aiju> the number might be too big
15:28 < skelterjohn> are you using the go playground?
15:28 < skelterjohn> but time.Sleep is a noop there
15:28 < skelterjohn> but = because
15:28 < skelterjohn> the "ut" is right next to the "ecause"...
15:29 < GeertJohan> I found time.Sleep in the documentation...
15:29 < GeertJohan> http://golang.org/pkg/time/#Sleep
15:29 < skelterjohn> awesome
15:29 < skelterjohn> yes, i know it's a function
15:30 < GeertJohan> I dont know about go playground..  I just use
eclipse+goclipse which is using 6g to compile
15:30 < skelterjohn> try with something smaller, like 2e9 (which is two
seconds)
15:30 < GeertJohan> ack
15:31 < GeertJohan> that works :)
15:31 < skelterjohn> good!
15:31 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
15:36 -!- prasmussen [pii@rasm.se] has quit [Ping timeout: 252 seconds]
15:36 -!- prasmussen [pii@rasm.se] has joined #go-nuts
15:38 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
15:39 -!- Adys [~Adys@unaffiliated/adys] has quit [Remote host closed the
connection]
15:43 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
15:45 < wrtp> Geert: if you want main to wait forever, you can also do
select{}
15:45 < GeertJohan> wrtp: ok, that doesnt lock up my cpu like for{} does?
15:46 < uriel> the 'proper' way to do it is to wait on a channel and have
the other goroutines signal when they are done by sending on that channel
15:48 < wrtp> GeertJohan: no, it does nothing at all
15:48 < wrtp> uriel: sometimes you want to run forever; or have some other
goroutine call os.Exit
15:50 < aiju> uriel: i thought the proper way to do something is the simple
one
15:53 -!- piranha [~piranha@5ED42E59.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
15:54 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
15:55 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
15:59 -!- photron_ [~photron@port-92-201-132-247.dynamic.qsc.de] has joined
#go-nuts
16:01 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
16:05 < GeertJohan> hehe it wasnt my intention to start a discussion on the
proper way to do it :P however, select{} DOES make it work :)
16:05 < GeertJohan> thx
16:06 * wrtp has a blue box with a black border
16:06 < wrtp> just have to do mouse input now and we'll have mac os native
graphics interaction, woo woo
16:06 < uriel> aiju: note the quotes
16:06 < uriel> around 'proper'
16:07 < aiju> hehe
16:07 < wrtp> might be stupendously slow mind
16:07 < aiju> the KICCHIRI way
16:07 < aiju> (i don't think anyone got that reference)
16:07 < wrtp> depends if i've picked the right API
16:07 -!- artefon [~thiago@dhcp26.usuarios.dcc.ufmg.br] has joined #go-nuts
16:07 < wrtp> good place to stop for the night
16:08 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has joined #go-nuts
16:08 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has left #go-nuts []
16:08 -!- rlab_ [~Miranda@91.200.158.34] has joined #go-nuts
16:08 -!- Adys [~Adys@unaffiliated/adys] has joined #go-nuts
16:09 -!- rlab [~Miranda@91.200.158.34] has quit [Ping timeout: 260 seconds]
16:11 -!- gedevan [~gedevan@83.167.106.253] has joined #go-nuts
16:13 -!- boscop_ [~boscop@g227129086.adsl.alicedsl.de] has joined #go-nuts
16:15 -!- tvw [~tv@212.79.9.150] has quit [Ping timeout: 240 seconds]
16:16 -!- boscop [~boscop@g230103202.adsl.alicedsl.de] has quit [Ping timeout: 248
seconds]
16:16 -!- unofficialmvp1 [~dev@94-62-164-227.b.ipv4ilink.net] has joined #go-nuts
16:17 -!- boscop__ [~boscop@f055019122.adsl.alicedsl.de] has joined #go-nuts
16:19 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
16:20 -!- boscop_ [~boscop@g227129086.adsl.alicedsl.de] has quit [Ping timeout:
240 seconds]
16:21 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
16:22 -!- unofficialmvp1 [~dev@94-62-164-227.b.ipv4ilink.net] has left #go-nuts []
16:24 -!- boscop__ [~boscop@f055019122.adsl.alicedsl.de] has quit [Ping timeout:
240 seconds]
16:34 -!- rlab_ [~Miranda@91.200.158.34] has quit [Ping timeout: 240 seconds]
16:37 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
16:38 -!- TMKCodes [~TMKCodes@unaffiliated/tmkcodes] has quit [Ping timeout: 260
seconds]
16:38 -!- skelterjohn [~jasmuth@lawn-gw.rutgers.edu] has joined #go-nuts
16:41 -!- TMKCodes [~TMKCodes@unaffiliated/tmkcodes] has joined #go-nuts
16:42 < mdxi> the satellite which everyone is all "EINSTEIN WAS RIGHT!"
about was Gravity Probe B
16:42 < mdxi> i got to wondering where Gravity Probe A was, if there had
been one.
16:42 < mdxi> there was.  June 18, 1976
16:43 < mdxi> http://en.wikipedia.org/wiki/Gravity_Probe_A
16:44 -!- bortzmeyer [~stephane@2a01:e35:8bd9:8bb0:e115:8ede:a8e5:d5c1] has joined
#go-nuts
16:47 -!- blackmagik [~blackmagi@host-66-202-73-207.choiceone.net] has joined
#go-nuts
16:47 -!- blackmagik [~blackmagi@host-66-202-73-207.choiceone.net] has quit
[Changing host]
16:47 -!- blackmagik [~blackmagi@unaffiliated/blackmagik] has joined #go-nuts
16:53 -!- Project-2501 [~Marvin@82.84.65.7] has joined #go-nuts
16:56 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-156-86.clienti.tiscali.it] has
quit [Ping timeout: 240 seconds]
17:06 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has joined #go-nuts
17:06 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has left #go-nuts []
17:17 -!- ab3 [~abe@83.101.90.66] has joined #go-nuts
17:19 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
17:19 -!- Bigbear11 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
17:21 -!- Bigbear11 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Client Quit]
17:21 -!- Bigbear11 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
17:21 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
17:21 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
17:26 -!- unofficialmvp1 [~dev@94-62-164-227.b.ipv4ilink.net] has joined #go-nuts
17:26 -!- unofficialmvp1 [~dev@94-62-164-227.b.ipv4ilink.net] has left #go-nuts []
17:28 -!- Ell [5b9a07e9@gateway/web/freenode/ip.91.154.7.233] has joined #go-nuts
17:29 -!- wrtp [~rog@92.17.111.113] has quit [Quit: wrtp]
17:30 -!- Mr_Dark [~dk@poviko.demon.nl] has quit [Ping timeout: 260 seconds]
17:32 -!- ezys [~ezys@c-67-161-85-212.hsd1.wa.comcast.net] has quit [Ping timeout:
252 seconds]
17:38 -!- ezys [~ezys@c-67-161-85-212.hsd1.wa.comcast.net] has joined #go-nuts
17:40 -!- tvw [~tv@e176001002.adsl.alicedsl.de] has joined #go-nuts
17:44 -!- vsayer [~vivek@c-67-170-236-166.hsd1.ca.comcast.net] has quit [Ping
timeout: 246 seconds]
17:45 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has quit [Ping
timeout: 252 seconds]
17:46 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has joined #go-nuts
17:46 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has left #go-nuts []
17:46 -!- Fish- [~Fish@9fans.fr] has joined #go-nuts
17:47 -!- sjbrown [~sjbrown@adsl-99-189-162-6.dsl.pltn13.sbcglobal.net] has joined
#go-nuts
17:47 -!- sjbrown [~sjbrown@adsl-99-189-162-6.dsl.pltn13.sbcglobal.net] has quit
[Client Quit]
17:47 -!- kkress [~kkress@2001:470:1:41::403e:ad36] has joined #go-nuts
18:01 -!- keithcascio [~keithcasc@nat/google/x-ocntcultyilnkitf] has joined
#go-nuts
18:02 -!- Bigbear11 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Ping
timeout: 260 seconds]
18:02 -!- TheMue [~TheMue@p5DDF6427.dip.t-dialin.net] has joined #go-nuts
18:02 -!- Project_2501 [~Marvin@82.84.99.9] has joined #go-nuts
18:03 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
18:05 -!- Project-2501 [~Marvin@82.84.65.7] has quit [Ping timeout: 240 seconds]
18:07 -!- pearle [~pearle@blk-224-181-222.eastlink.ca] has quit [Quit: Leaving]
18:07 < kimelto> am I the only one who find that the use of the url domain
by goinstall gives us silly import path?  github.com/foo/bar for instance.
18:07 < Bigbear1> how do I check a subscript of a number
18:08 < Bigbear1> num[i]?
18:08 < Bigbear1> or does it need to be a string and which brackets do I
use?
18:09 < skelterjohn> what is a subscript of a number?
18:09 < Bigbear1> like if num = 123
18:09 < Bigbear1> num[0] = 1
18:09 < fzzbt> kimelto: no no, i agree it's silly.
18:09 < skelterjohn> ah
18:09 < skelterjohn> one way would be to turn it to a string
18:09 < Bigbear1> and use square braces?
18:09 < skelterjohn> fmt.Sprintf("%d", num)[0]
18:10 < skelterjohn> that gets you the character '1'
18:10 < Bigbear1> ok ty
18:10 < skelterjohn> fzzbt, kimelto: why do you think it's silly?
18:10 < aiju> Bigbear1: you can just use math ;P
18:10 < skelterjohn> aiju: i didn't want to have to explain any math
18:10 < aiju> 123 / 100 = 1, for instance
18:10 < skelterjohn> aiju: that's just the hundreds digit
18:11 < skelterjohn> not the "first" digit
18:11 < aiju> getting the first digit is not much harder
18:11 < aiju> x := 123
18:11 < aiju> for x > 10 { x /= 10 }
18:11 < aiju> there you go
18:11 < aiju> ehm >=
18:12 < skelterjohn> or...  fmt.Sprintf("%d", num)[0]
18:12 < fzzbt> skelterjohn: because it binds the project import path to a
code hosting service, which means you have to change it if you ever decide to host
your project somewhere else.
18:12 -!- ab3 [~abe@83.101.90.66] has quit [Ping timeout: 252 seconds]
18:12 < skelterjohn> changing where you put it doesn't break anything
18:12 < skelterjohn> once people have installed it and it's working
18:13 < skelterjohn> only if they want the new version
18:13 < skelterjohn> and if they do, well, they're writing code anyway
18:13 -!- elephants [~elephants@76.9.192.146] has joined #go-nuts
18:13 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
18:14 < kimelto> skelterjohn: too long, what happen if the project moves to
a new forge?
18:14 < aiju> you have to change the code any second week anyway
18:14 < skelterjohn> what i just said
18:14 < kimelto> but it should definetly be in a subdir
18:15 < skelterjohn> ?
18:15 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
18:15 < Bigbear1> what is wrong with my for loops
18:15 < Bigbear1> for i int = 0;i<(len(num)/2);i++ {
18:15 < Bigbear1> expected {
18:15 < aiju> error?
18:15 < skelterjohn> Bigbear1: len() doesn't work on ints
18:15 < Bigbear1> it is a string
18:15 < kimelto> skelterjohn: sorry ;)
18:15 < skelterjohn> for i int = 0
18:15 < skelterjohn> doesn't make sense
18:16 < Bigbear1> var i int = 0?
18:16 < skelterjohn> you can say "i := 0"
18:16 < skelterjohn> i don't think you can put a var inside a for condition
18:16 < skelterjohn> you could also declare i before the for loop
18:16 < Bigbear1> i int := 100
18:16 < Bigbear1> same error
18:17 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Ping timeout: 240
seconds]
18:18 < skelterjohn> that's because you wrote something different than what
i suggested
18:20 < Bigbear1> no int?
18:21 < kimelto> :)
18:23 < Bigbear1> can I type cast (string) (i*j)
18:23 < Bigbear1> passes the value of i*j as a string
18:24 < skelterjohn> no
18:24 < Bigbear1> I got a panic runtime error
18:24 < Bigbear1> how do I type cast then
18:24 < skelterjohn> there is no casting in go
18:24 < skelterjohn> only converting
18:24 < kimelto> you format it with fmt?
18:25 < skelterjohn> to turn a number into a string you can do what i said
with fmt.Sprintf earlier
18:25 < Bigbear1> I am passing it to a function
18:25 -!- Zoopee [alsbergt@zoopee.org] has quit [Read error: Connection reset by
peer]
18:26 -!- Zoopee [alsbergt@zoopee.org] has joined #go-nuts
18:27 <+iant> strings aren't numbers, so what do you mean by converting a
number to a string?
18:27 <+iant> if you want the printed representation of the nmber, use
Sprintf
18:28 -!- Kafo [5b98bdf4@gateway/web/freenode/ip.91.152.189.244] has quit [Ping
timeout: 252 seconds]
18:29 < Bigbear1> I want to pass a number to a function that accepts strings
18:29 < aiju> use Sprintf
18:29 < aiju> god damnit.  listen to us.
18:29 < Bigbear1> so I need another variable that converts then I pass that
variable
18:30 < xyproto> hm, gonuts.org/pkg has stopped working
18:30 < Bigbear1> so Sprintf doesn't just print it as a string?
18:30 < xyproto> strconv can also be used to convert numbers to strings
18:30 < xyproto> http://golang.org/pkg/strconv/#Itoa
18:30 < skelterjohn> Bigbear1: Sprintf doesn't print anything
18:30 < skelterjohn> Printf prints
18:31 < skelterjohn> Sprintf writes to a string and returns it
18:32 < Bigbear1> if isPalin(Sprintf(i*j)) {
18:32 < aiju> Sprintf("%d", i*j)
18:32 < aiju> as has been mentioned over 9000 times
18:33 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
18:33 < xyproto> :D
18:33 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
18:33 < xyproto> just saw the last part of the conversation
18:35 < Bigbear1> ok so I am trying to use Itoa and I have import "strconv"
and it says imported and not used strconv undefined Itoa
18:35 -!- artefon [~thiago@dhcp26.usuarios.dcc.ufmg.br] has quit [Ping timeout:
240 seconds]
18:36 < xyproto> Bigbear1: import ("strconv")
18:36 < xyproto> Bigbear1: then strconv.Itoa("123")
18:37 < xyproto> Bigbear1: but, as I understand other here have said, this
solution is just as good, or better:
18:37 < xyproto> Bigbear1: import ("fmt")
18:37 -!- oal [~oal@5.79-160-122.customer.lyse.net] has joined #go-nuts
18:37 < oal> Hey
18:37 < kimelto> ho!
18:37 < xyproto> Bigbear1: fmt.Sprintf("%d", 123)
18:37 < xyproto> Bigbear1: and sorry, I meant 123, not "123"
18:37 < oal> Is the Go docs available in pdf for my kindle?  Or are there
any good books out yet?
18:37 < Bigbear1> same thing panic:runtime error
18:37 < aiju> heh Go docs in PDF would be interesting
18:38 < xyproto> Bigbear1: if you paste it at go.pastie.org it should be
possible to figure out what's wrong
18:38 < oal> aiju, so there's *that* much documentation?
18:38 < xyproto> oal: there's a book or two and a few good presentations
available, I think
18:38 < aiju> oal: well, specification, package documentation
18:39 < skelterjohn> it would be a few hundred pages long
18:39 < aiju> i have to admit not having seen a book which looked good, but
i haven't actually read any
18:39 < skelterjohn> i dislike programming books
18:39 < oal> Ah. Well, how do you recommend me learning Go? I'm coming from
the Python world.
18:39 < aiju> there are indeed few good ones
18:39 < xyproto> oal: http://go-lang.cat-v.org/doc/
18:39 < aiju> practice
18:39 < Bigbear1> Deitel and Deitel are good
18:39 < skelterjohn> oal: there are some tutorials on the golang.org site
18:40 < oal> Thanks.  Maybe I should instapaper the tutorial at first and
play with it, then study more of the details later?
18:41 < skelterjohn> seems reasonable
18:41 < oal> xyproto, oh, there's a pdf there.  Downloading it :)
18:41 < Bigbear1> http://pastebin.com/GPGiqzB4
18:42 < oal> Thanks guys!  :-)
18:42 < aiju> just choose some fun project and work on it
18:42 < aiju> somewhat related, "The best way to get familiar with a
terminal is to play games" (UPE)
18:42 < Bigbear1> why am I getting a panic: run time error
18:43 < skelterjohn> Bigbear1: because there is a bug in your code
somewhere, and we can't tell you where because we can't see your code
18:43 <+iant> he just pasted it, though
18:43 < Bigbear1> http://pastebin.com/GPGiqzB4
18:43 < skelterjohn> oh
18:43 < skelterjohn> :)
18:44 < skelterjohn> num [len(num)-i]
18:44 < skelterjohn> when i = 0 this will be a problem
18:44 < skelterjohn> the last valid index on a string of length N is N-1
18:44 < skelterjohn> not N
18:44 < xyproto> Bigbear1: I'm trying to write a working version of your
program.  What is isPalin supposed to do?  Check if the string is a palindrom?
18:45 < skelterjohn> you probably want num[len(num)-i-1]
18:45 < xyproto> *palindrome
18:45 < Bigbear1> yes
18:46 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
18:46 < xyproto> ah, he didn
18:47 < xyproto> didn't want string conversion, but generate all possible
words
18:47 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
18:47 -!- ab3 [~abe@83.101.90.66] has joined #go-nuts
18:47 < skelterjohn> string conversion is a reasonable way to do that
18:48 < skelterjohn> it involves extra allocations, but has the same runtime
18:48 < xyproto> skelterjohn: but, you can't use Itoa for generating
strings?
18:48 < xyproto> skelterjohn: in that fashion
18:48 < skelterjohn> i don't understand
18:49 < skelterjohn> sure you can?
18:49 < xyproto> skelterjohn: if you want "aaaa", "aaab", "aaac" etc
18:49 < xyproto> skelterjohn: would you use Itoa?
18:49 < skelterjohn> he doesn't
18:49 < skelterjohn> he wants numerical palindromes
18:49 < xyproto> skelterjohn: oh, ok
18:49 < xyproto> skelterjohn: ahhh, I see.
18:49 < xyproto> phew
18:49 < skelterjohn> what i*j are palindromes, for certain i, j
18:49 < aiju> 11 is a good start
18:49 -!- bortzmeyer [~stephane@2a01:e35:8bd9:8bb0:e115:8ede:a8e5:d5c1] has quit
[Quit: Leaving.]
18:49 < skelterjohn> 100 <= i,j < 1000
18:50 < skelterjohn> aiju: i'd probably start at 0
18:50 < Bigbear1> ok so how do I declare a integer with the value 0
18:50 < aiju> all palindromes of a certain length are divisible by 11, 111,
1111, etc.
18:50 < skelterjohn> Bigbear1: var theIntegerWIthValueZero int
18:51 < Bigbear1> var num int := 0
18:51 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
18:51 < aiju> or something ..
18:51 < skelterjohn> aiju: really?  that seems surprising
18:51 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
18:51 < skelterjohn> Bigbear1: that is not what i wrote
18:51 < aiju> skelterjohn: i'm not entirely sure
18:51 < skelterjohn> you can't *ever* specify the type and use ":=" at the
same time
18:51 < Bigbear1> ok so I use =?
18:51 < Bigbear1> var num int = 0
18:51 < skelterjohn> aiju: I don't have a reason to disbelieve you besides
not seeing the connection
18:51 < Bigbear1> still wrong
18:51 < aiju> skelterjohn: doesn't seem to be true, there was something like
that
18:52 < skelterjohn> Bigbear1: that works, you can also leave off the =0
since all variables get zero when initialized
18:52 < aiju> Bigbear1: = and := are TWO DIFFERENT THINGS
18:52 < skelterjohn> aiju: maybe quotes would have been in order
18:52 -!- artefon [~thiago@150.164.2.20] has joined #go-nuts
18:52 -!- snearch [~snearch@f053005025.adsl.alicedsl.de] has joined #go-nuts
18:52 < skelterjohn> because : = and := look similar
18:53 -!- telexicon [~telexicon@unaffiliated/chowmeined] has joined #go-nuts
18:55 < Bigbear1> var num int = 0 works though/
18:55 < skelterjohn> ...
18:56 < skelterjohn> yes.
18:56 < Bigbear1> says num declared and not used
18:56 < Bigbear1> when it is being used
18:56 < Bigbear1> and when I take out the var it has the lines where it is
used saying num undeclared
18:57 < skelterjohn> is this the same program?
18:57 < skelterjohn> because you have a num that is a string in there
18:57 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
18:58 -!- virtualsue [~chatzilla@nat/cisco/x-lkzkjvoguphckqjh] has quit [Ping
timeout: 240 seconds]
18:59 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
18:59 < xyproto> Bigbear1: http://go.pastie.org/1872641
19:00 < xyproto> Bigbear1: len(s)-i will be len(s)-0 at some point, and
s[len(s)-0] is out of bounds, as the index counts from 0, not from 1
19:00 < Bigbear1> right I need the -1
19:01 < xyproto> Bigbear1: right
19:01 < Bigbear1> http://pastebin.com/1w59fq80
19:01 < Bigbear1> now I just want to print only the largest
19:01 < xyproto> Bigbear1: also, "gofmt -w myfile.go"
19:02 < Bigbear1> it only changed teh second import
19:05 < xyproto> Bigbear1: http://go.pastie.org/1872675
19:07 < Bigbear1> ok but what is wrong with my code?
19:07 < Bigbear1> it says largest is being used but not declared
19:07 < Bigbear1> err largest used without being declared rather
19:08 < xyproto> Bigbear1: I can offer to teach you the meaning of :=
instead, then you will see it
19:08 < aiju> Bigbear1: we tried, several times
19:09 < skelterjohn> Bigbear1: i suggest you refrain from using the ":="
operator
19:09 < skelterjohn> until you know what it means
19:09 < skelterjohn> in the meantime, declare variables using var
19:09 < skelterjohn> and assign them using "="
19:10 < xyproto> Bigbear1: "var x int" and then "x = 2" has roughly the same
meaning as "x := 2"
19:11 < xyproto> Bigbear1: so, "largest := i*j" means "var largest int;
largest = i*j", every time you run the loop.  To fix it, just use "=" instead of
":=" in that place.
19:11 -!- Venom_X [~pjacobs@75-27-133-72.lightspeed.austtx.sbcglobal.net] has quit
[Ping timeout: 240 seconds]
19:11 < xyproto> Bigbear1: you see?
19:12 < Bigbear1> yes
19:12 < xyproto> Bigbear1: yey :)
19:12 < Bigbear1> but why
19:12 < skelterjohn> :|
19:12 < Bigbear1> usually you have a set equal operator
19:12 < Bigbear1> and an initilize operator
19:12 < Bigbear1> and a comparison operator
19:13 < xyproto> Bigbear1: one of the reasons, is that it's tiresome to have
to write "var i int" and then "for i = 0; i < 123; i++" every time you really
just want to write one line
19:13 < xyproto> Bigbear1: if you want to go minimalistic, you don't really
need much syntax at all.  You could do a lot with just 8 instructions.
19:14 < Namegduf> It's mostly useful for mixed cases.
19:14 < xyproto> Bigbear1: + could be 1, ++ could be 2 +++ could be 3, etc.
Why have numbers?
19:14 < xyproto> Bigbear1: some syntaxtic sugar makes people happy
19:14 < Namegduf> f, err := ...; ...  bar, err := ...
19:14 < xyproto> *syntactic sugar
19:15 < Namegduf> It's syntactic sugar for type inference that allows a lot
of code to be more compact, as opposed to rare bits of code.
19:15 < Namegduf> *for a type inferencing var
19:16 < xyproto> Bigbear1: Go is very anti-sugar for some ideas, though, and
pro others.  Like all languages.  As I was told when I started out with Go, the
bike shed has already been painted.
19:16 < xyproto> And who wants an unpainted bike shed?
19:16 < xyproto> Not me.
19:17 < Namegduf> I think Go tends to be anti-sugar except where it's really
really helpful in a LOT of code.
19:17 < Namegduf> Most proposed sugar seems to affect only occasional uses
of a construct.
19:17 < xyproto> How about you, skelterjohn, do you want an unpainted bike
shed?
19:18 -!- Venom_X [~pjacobs@66.54.185.131] has joined #go-nuts
19:18 < skelterjohn> wat
19:18 < xyproto> skelterjohn: I thought so.
19:18 < skelterjohn> i wasn't paying attention
19:19 < xyproto> skelterjohn: I was just talking about how the bikshed of
syntactical sugary goodness had already been painted.
19:19 < skelterjohn> i hate metaphors
19:19 < xyproto> skelterjohn: every good metaphor is like...  a car
19:19 < skelterjohn> that's a simile
19:20 < xyproto> similes are cars too
19:20 < skelterjohn> your face is a car
19:20 < xyproto> :D
19:20 < xyproto> skelterjohn: I don't get it
19:22 -!- Mr_Dark [~dk@poviko.demon.nl] has joined #go-nuts
19:23 < xyproto> Bigbear1: Did you figure out everything?
19:26 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Read error:
Connection reset by peer]
19:26 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
19:26 < Bigbear1> How do I format a really long if statement without the
extra round brackets it adds a semi colon at the end of each line
19:26 < Bigbear1> gofmt didn't help either
19:27 < Bigbear1> it said found IDENT\
19:27 < TheMue> Bigbear1: Has it to be so long?
19:27 < xyproto> Bigbear1: in general, you don't always need () but it's
handy to throw in {} everywhere
19:28 < TheMue> Bigbear1: That's not very maintainable.  So can't you split
it in boolean descissions before?
19:28 < xyproto> Bigbear1: if you want really long lines, I think you can
use just "\" at the end of the line, if I remember correctly
19:29 < skelterjohn> xyproto: i don't think so
19:29 < xyproto> nope, forget what I said
19:29 < xyproto> \ does not continue lines on the next line
19:29 < skelterjohn> you can split a line into multiple lines by choosing
carefully where to put the carriage return
19:29 < xyproto> Bigbear1: what's wrong with just having a really long line?
19:29 < skelterjohn> can't be immediately after an ident
19:29 < xyproto> skelterjohn: good point
19:29 < skelterjohn> but it can be after, for instance a comm
19:29 < skelterjohn> a
19:30 < xyproto> Bigbear1: you can assign values to variables to make if
sentences shorter
19:30 < TheMue> I would do:
19:30 < TheMue> c1 := ...
19:30 < TheMue> c2 := ...
19:31 < TheMue> c3 := ...
19:31 < TheMue> if c1 && c2 && c3 { ...  }
19:31 < TheMue> c1 to c3 are criteria 1 to criteria 3
19:31 < TheMue> with boolean expressions behind it
19:32 -!- gedevan [~gedevan@83.167.106.253] has quit [Quit: Leaving...]
19:33 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
19:33 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has quit [Ping timeout:
240 seconds]
19:34 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
19:34 -!- skelterjohn [~jasmuth@lawn-gw.rutgers.edu] has quit [Quit: skelterjohn]
19:34 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has joined #go-nuts
19:37 -!- artefon [~thiago@150.164.2.20] has quit [Quit: bye]
19:46 -!- wrtp [~rog@92.17.111.113] has joined #go-nuts
19:46 -!- wrtp [~rog@92.17.111.113] has quit [Client Quit]
19:50 -!- ezys [~ezys@c-67-161-85-212.hsd1.wa.comcast.net] has quit [Quit: WeeChat
0.3.3]
19:52 -!- wrtp [~rog@92.17.111.113] has joined #go-nuts
19:53 -!- GeertJohan [~Squarc@ip4da06866.direct-adsl.nl] has quit [Quit: Leaving.]
19:54 -!- wrtp [~rog@92.17.111.113] has quit [Client Quit]
19:59 -!- KingPhilroy [~kingphilr@shc-nat-newhall.stonehill.edu] has joined
#go-nuts
20:11 -!- Kafo [5b98bdf4@gateway/web/freenode/ip.91.152.189.244] has joined
#go-nuts
20:13 -!- edsrzf [~edsrzf@122-61-221-144.jetstream.xtra.co.nz] has joined #go-nuts
20:14 -!- imsplitbit [~imsplitbi@64.39.4.132] has quit [Quit: Bye!]
20:16 -!- rutkowski [~adrian@078088214214.walbrzych.vectranet.pl] has joined
#go-nuts
20:19 -!- wrtp [~rog@92.17.111.113] has joined #go-nuts
20:25 -!- snearch [~snearch@f053005025.adsl.alicedsl.de] has quit [Quit:
Verlassend]
20:27 -!- wrtp [~rog@92.17.111.113] has quit [Quit: wrtp]
20:39 -!- Bigbear1 [~Cody@d173-181-43-12.abhsia.telus.net] has left #go-nuts []
20:41 -!- zerosanity [~josh@8.20.178.82] has quit [Remote host closed the
connection]
20:47 -!- edsrzf [~edsrzf@122-61-221-144.jetstream.xtra.co.nz] has quit [Remote
host closed the connection]
20:50 -!- edsrzf [~edsrzf@122-61-221-144.jetstream.xtra.co.nz] has joined #go-nuts
20:54 -!- rutkowski [~adrian@078088214214.walbrzych.vectranet.pl] has quit [Quit:
WeeChat 0.3.3-dev]
20:56 < nictuku> What do you folks use to replace struct data fields for
interfaces?  "getter" and "setter" methods?
20:56 < aiju> rethink our interface
20:57 -!- oal [~oal@5.79-160-122.customer.lyse.net] has quit [Remote host closed
the connection]
21:01 -!- wrtp [~rog@92.17.111.113] has joined #go-nuts
21:09 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
21:10 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
21:10 -!- Project_2501 [~Marvin@82.84.99.9] has quit [Ping timeout: 252 seconds]
21:10 -!- Fish- [~Fish@9fans.fr] has quit [Quit: So Long, and Thanks for All the
Fish]
21:12 -!- blackmagik [~blackmagi@unaffiliated/blackmagik] has quit [Quit: Leaving]
21:12 -!- blackmagik [~blackmagi@unaffiliated/blackmagik] has joined #go-nuts
21:14 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Quit:
Leaving.]
21:18 -!- PJRobins [~kvirc@184-100-100-163.mpls.qwest.net] has quit [Remote host
closed the connection]
21:19 -!- PJRobins [~kvirc@184-100-100-163.mpls.qwest.net] has joined #go-nuts
21:21 -!- PJRobins [~kvirc@184-100-100-163.mpls.qwest.net] has quit [Client Quit]
21:22 -!- PJRobins [~kvirc@184-100-100-163.mpls.qwest.net] has joined #go-nuts
21:25 -!- elephants [~elephants@76.9.192.146] has quit [Remote host closed the
connection]
21:27 -!- TheMue [~TheMue@p5DDF6427.dip.t-dialin.net] has quit [Quit: TheMue]
21:30 -!- tylerl [~tylerl@ip24-251-232-171.ph.ph.cox.net] has joined #go-nuts
21:30 < tylerl> How do I get the error number off a call to os.Stat()?  I
want switch between error causes.
21:33 -!- kr [~Keith@204.14.152.118] has joined #go-nuts
21:34 < tylerl> hello?
21:34 -!- virtualsue [~chatzilla@nat/cisco/x-nifajmvhlwnqxxnt] has joined #go-nuts
21:35 < skelterjohn> hi
21:35 < skelterjohn> um, not sure off the top of my head
21:35 < tylerl> ok, thanks anyway
21:35 < skelterjohn> check out the Stat code
21:35 < skelterjohn> see what it returns
21:35 < skelterjohn> it's possible it returns os.NewError("some useful
message")
21:35 < skelterjohn> in which case the only thing you can compare against is
that string
21:36 < tylerl> skelterjohn: I'm not particularly interested in a useful
message.
21:36 < skelterjohn> lol
21:37 < aiju> tylerl: os.SyscallErrno
21:37 < aiju> i'm not entirely sure what you're trying to do, though
21:38 -!- foocraft [~ewanas@78.100.222.158] has quit [Quit: Leaving]
21:38 < tylerl> aiju: I'm calling os.Stat() which can fail due to a number
of different causes (not found, no permission, etc.) and I'm trying to address
each situation separately
21:38 < aiju> yeah, but why
21:39 < skelterjohn> os.Stat returns a os.PathError
21:39 < skelterjohn> which has an Error field
21:39 < aiju> in any case there should be enough constants in os
21:41 < tylerl> aiju: but how do i get at the particular constant associated
with a returned error?
21:41 < skelterjohn> the error you get is a PathError which has an Error
field - the Error is an interface holding a syscall.Error
21:42 < aiju> tylerl: err == os.Eperm?
21:42 < aiju> not entirely sure
21:42 < skelterjohn> err
21:42 < skelterjohn> syscall.Error is another interfac
21:42 < skelterjohn> e
21:43 < skelterjohn> what it actually is is buried somewhere in the syscall
source
21:43 < skelterjohn> too much effort right now
21:49 -!- sebastianskejoe [~sebastian@188.114.142.217] has quit [Quit: Lost
terminal]
21:50 -!- unhygienix [~unhygieni@host86-135-59-30.range86-135.btcentralplus.com]
has quit [Quit: unhygienix]
21:55 -!- fmoo [~Adium@66.220.144.74] has joined #go-nuts
21:56 -!- blackmagik [~blackmagi@unaffiliated/blackmagik] has quit [Read error:
Connection reset by peer]
21:57 -!- photron_ [~photron@port-92-201-132-247.dynamic.qsc.de] has quit [Ping
timeout: 260 seconds]
21:59 -!- virtualsue [~chatzilla@nat/cisco/x-nifajmvhlwnqxxnt] has quit [Ping
timeout: 246 seconds]
22:02 -!- plainhao [~plainhao@208.75.85.237] has quit [Quit: plainhao]
22:03 -!- jbooth1 [~jay@209.249.216.2] has left #go-nuts []
22:05 -!- Venom_X [~pjacobs@66.54.185.131] has quit [Quit: Venom_X]
22:06 -!- virtualsue [~chatzilla@nat/cisco/x-akyrrrjevxoysppy] has joined #go-nuts
22:10 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
22:15 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
22:24 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
22:28 -!- fmoo [~Adium@66.220.144.74] has quit [Remote host closed the connection]
22:28 < kimelto> mmh I am getting garbage at the end, when a Reader returns
EOF.  is the buffer is small, say 10, it's fine
22:31 < kimelto> http://go.pastie.org/1873358
22:34 < delinka> you're ignoring the int in the return
22:35 < kimelto> oh I thought len(buf) would do the trick
22:35 < delinka> it'll still be 1024.  it doens't reallocate the buffer.
22:35 < delinka> it just fills it.
22:36 < kimelto> len() not cap()
22:37 -!- fmoo [~Adium@66.220.144.74] has joined #go-nuts
22:39 < delinka> I see an array.  did I miss the slice based on the array
some place?
22:40 < kimelto> you mean that buf is an array and not a slice?
22:41 -!- chimes [~chimes@24.104.130.118] has quit [Quit: chimes]
22:41 < delinka> right
22:42 < delinka> ok, that really might not be entirely accurate, but still
the Read() call wouldn't magically change the slice's capacity
22:43 < delinka> if it was returning a slice, it could return to you the
slice with the newest data in it
22:44 < delinka> but since there's an int in the return values, you can then
create your own slice from the array, and output *that*
22:48 -!- rlab [~Miranda@91.200.158.34] has quit [Read error: Connection reset by
peer]
22:52 -!- napsy [~luka@88.200.96.18] has quit [Quit: Lost terminal]
22:55 -!- Kafo [5b98bdf4@gateway/web/freenode/ip.91.152.189.244] has quit [Ping
timeout: 252 seconds]
22:55 -!- bhlemg [5b9a07e9@gateway/web/freenode/ip.91.154.7.233] has quit [Ping
timeout: 252 seconds]
22:57 < kimelto> the thing which I dont understand is since a slice has a
len, why Read() returns the len and do not change the len of the slice...
22:58 -!- pharris [~Adium@rhgw.opentext.com] has quit [Quit: Leaving.]
22:59 < delinka> I can't answer the "why" but my guess would be to keep
parity with similar APIs in C
23:05 < Namegduf> Because the slice is passed by value.
23:06 < Namegduf> A slice is a little struct, not a little pointer to a
struct.
23:06 < Namegduf> If you change the len of one it doesn't change the length
of other copies of the slice.
23:07 < Namegduf> It's like asking, why if you pass in a number, doesn't it
change that number instead of returning a new one.
23:08 < delinka> this is where my brain takes a moment to process things ...
it passes the *slice* by value so changes to the slice "struct" would by useless,
but since the slice *references* the original array elements, the original array
elements change in value
23:09 < delinka> s/by/be/
23:09 < Namegduf> Yep.
23:09 < Namegduf> Slightly annoyingly, I just got a better way to explain
it.
23:09 < Namegduf> You *can't* change the length of a slice.
23:10 < Namegduf> You can only slice it and make a new one.
23:10 -!- cenuij [~cenuij@base/student/cenuij] has quit [Remote host closed the
connection]
23:10 < Namegduf> If you assign that new one to the same place the old one
was, it overwrites, but it doesn't affect any other places still storing the old
one.
23:10 < Namegduf> That way, things can slice up the slice they're given
without affecting parents all they like.
23:12 < kimelto> and how can I decrease the len of a slice btw?
23:12 < Namegduf> s = s[:newlen]
23:12 < kimelto> how I see
23:13 < kimelto> so it kinda create a new one and the old one is garbage
collected, right?
23:13 < delinka> yes
23:14 < Namegduf> Well, no.
23:14 < kimelto> so I got the behavior I want with buf = buf[:n], thanks
23:14 -!- kr [~Keith@204.14.152.118] has quit [Quit: WeeChat 0.3.4]
23:15 < delinka> why would that not create a new slice?
23:15 -!- virtualsue [~chatzilla@nat/cisco/x-akyrrrjevxoysppy] has quit [Ping
timeout: 252 seconds]
23:15 < Namegduf> Slices are structs, not pointers to structs.
23:16 < Namegduf> You just overwrite the old value of the struct with a new
value of it, nothing needs GCing
23:17 < kimelto> now I wonder if net.Read() can return a n < len(buf)
before EOF.  it is a blocking call right?
23:18 < kimelto> because if that's the case I am constantly decreasing my
slice
23:18 < Namegduf> Yes, it can.
23:18 < Namegduf> You should resize it back to the size of cap()
23:19 < kimelto> ok, good to know
23:19 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
23:20 -!- foocraft [~ewanas@86.36.49.200] has joined #go-nuts
23:20 < kimelto> I think I am starting to get it :p
23:20 -!- iant [~iant@nat/google/x-infitzhfobqmanmn] has quit [Quit: Leaving.]
23:21 -!- cafesofie [~cafesofie@ool-18b97779.dyn.optonline.net] has joined
#go-nuts
23:32 -!- iant [~iant@67.218.107.213] has joined #go-nuts
23:32 -!- mode/#go-nuts [+v iant] by ChanServ
23:43 -!- ios_ [~ios@180.191.91.34] has joined #go-nuts
23:49 -!- whitespacechar [~whitespac@24-247-159-7.dhcp.klmz.mi.charter.com] has
joined #go-nuts
23:51 < whitespacechar> I'm trying to write my first go program ...  running
into newbie problems.  Mac 64 bit; go installation went well; env vars are set.
23:51 < whitespacechar> But when I do an import statement, I get
"bloom.go:11: syntax error near runtime"
23:52 < whitespacechar> Is this a common error?  What am I doing wrong?
23:52 < skelterjohn> pastebin the code
23:52 <+iant> or at least show us line 11
23:53 < whitespacechar> http://pastebin.com/EeJSHGER
23:53 < skelterjohn> are you sure that's what you're compiling?  I don't see
"runtime" anywhere
23:54 < whitespacechar> well, exactly.
23:54 < skelterjohn> also, if you import fmt you have to use it
23:54 < skelterjohn> so that's one error
23:54 -!- foocraft [~ewanas@86.36.49.200] has quit [Ping timeout: 240 seconds]
23:55 -!- exch [~exch@c74149.upc-c.chello.nl] has quit [Quit: leaving]
23:57 -!- exch [~exch@c74149.upc-c.chello.nl] has joined #go-nuts
23:58 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has left #go-nuts
[]
23:58 -!- whitespacechar [~whitespac@24-247-159-7.dhcp.klmz.mi.charter.com] has
quit [Quit: whitespacechar]
23:58 -!- foocraft [~ewanas@86.36.49.200] has joined #go-nuts
--- Log closed Sat May 07 00:00:50 2011