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

--- Log opened Thu Nov 19 04:30:46 2009
04:31 < uriel> you should use gopaste ;P
04:31 < Gracenotes> true dat.  perhaps.
04:33 < uriel> hehe
04:34 < uriel> I'm not sure, but shouldn't you use a non-main package?
04:38 < Gracenotes> it's a main package to run the main method
04:38 < Gracenotes> take it out and it's basically its own (incomplete)
module.
04:40 < reppie> i'm bored.
04:41 < uriel> reppie: write some code then ;P
04:41 < reppie> i don't have any ideas
04:41 < reppie> on what to write
04:41 < uriel> reppie: and irc client
04:41 < reppie> no
04:41 < reppie> i'm very satisfied with my irc client :(
04:42 < reppie> and i don't think i could do better
04:43 < sladegen> write a rogue
04:43 < uriel> reppie: help out with my Goblin project, pick any random
classic unix/plan9 command and rewrite it in Go: http://repo.cat-v.org/goblin/
04:43 < uriel> sladegen: that is a nice idea too
05:14 < Gracenotes> I have what I think might be the original Zork source
code here.  perhaps I should try porting that :)
05:14 < Gracenotes> and if not original, rather close
05:26 < uriel> that sounds fun
05:27 < reppie> i wish i wasn't so lazy
05:27 < reppie> then maybe i'd code something
05:29 < Gracenotes> I know how you feel
05:29 < Gracenotes> :/
05:37 -!- sladegen [n=nemo@unaffiliated/sladegen] has quit [Read error: 104
(Connection reset by peer)]
05:37 -!- sladegen [n=nemo@unaffiliated/sladegen] has joined #go-run
06:57 < reppie> :\
08:33 -!- bquinn [n=bquinn@office.velleman.com] has joined #go-run
09:27 -!- bquinn [n=bquinn@office.velleman.com] has quit []
09:40 -!- assiss [n=assiss@219.143.153.59] has left #go-run []
09:40 -!- exch [n=nuada@h144170.upc-h.chello.nl] has left #go-run []
11:23 -!- bquinn [n=bquinn@nat/yahoo/x-xcrvqvknnzbztgla] has joined #go-run
11:43 -!- XniX23 [n=XniX23@89-212-198-49.dynamic.dsl.t-2.net] has joined #go-run
16:20 -!- rbohn [n=rbohn@192.206.100.4] has joined #go-run
16:20 < rbohn> @eval "go-run-hide"
16:20 <+rndbot> go-run-hide
16:30 < rbohn> > var msg []byte
16:30 <+rndbot> <no output>
16:31 < rbohn> > s := "abc"; s.Bytes()
16:31 <+rndbot> <Error: s.Bytes undefined (type string has no field
Bytes)>
16:32 < rbohn> @eval strings.Bytes("abc")
16:32 <+rndbot> [97 98 99]
16:33 < rbohn> var msg []byte; n,e := base64.StdEncoding.Decode(msg,
strings.Bytes("SSBuZXZlciBzYXcgYSBtb29yLCAKSSBuZXZlciBzYXcgdGhlIHNlYTsgCllldCBrbm93IEkgaG93
IHRoZSBoZWF0aGVyIGxvb2tzLCAKQW5kIHdoYXQgYSB3YXZlIG11c3QgYmUuIA0=");
fmt.Print(string(msg))
16:34 < rbohn> > var msg []byte; n,e := base64.StdEncoding.Decode(msg,
strings.Bytes("SSBuZXZlciBzYXcgYSBtb29yLCAKSSBuZXZlciBzYXcgdGhlIHNlYTsgCllldCBrbm93IEkgaG93
IHRoZSBoZWF0aGVyIGxvb2tzLCAKQW5kIHdoYXQgYSB3YXZlIG11c3QgYmUuIA0=");
fmt.Print(string(msg))
16:34 <+rndbot> <Error: syntax error near "<string>">
16:36 < rbohn> > var msg []byte; n,e := base64.StdEncoding.Decode(msg,
strings.Bytes("SSBuZXZlciBzYXcgYSBtb29yLCAKSSBuZXZlciBzYXcgdGhlIHNlYTsgCllldCBrbm93IEkgaG93
IHRoZSBoZWF0aGVyIGxvb2tzLCAKQW5kIHdoYXQgYSB3YXZlIG11c3QgYmUuIA0="));
fmt.Print(string(msg))
16:36 <+rndbot> <no output>
16:57 -!- exch [n=nuada@h144170.upc-h.chello.nl] has joined #go-run
16:57 < exch> > type F struct{ a int; } f:=Foo{123}; fmt.Printf("%v", f)
16:57 <+rndbot> <Error: undefined: Foo>
16:57 < exch> > type F struct{ a int; } f:=F{123}; fmt.Printf("%v", f)
16:57 <+rndbot> {123}
16:57 < exch> > type F struct{ a int;b string } f:=F{123,"wut"};
fmt.Printf("%v", f)
16:57 <+rndbot> {123 wut}
16:58 < exch> hmm
16:58 < exch> > type F struct{ a int;b string } f:=F{123,"wut etc"};
fmt.Printf("%v", f)
16:58 <+rndbot> {123 wut etc}
16:58 < exch> no comma separation?
16:59 < exch> > type F struct{ a,b,c string; } f:=F{"hello","go world",
"!"}; fmt.Printf("%v", f)
16:59 <+rndbot> {hello go world !}
17:02 < rbohn> >var msg []byte; base64.StdEncoding.Encode(msg,
strings.Bytes("google"))
17:02 < rbohn> > var msg []byte; base64.StdEncoding.Encode(msg,
strings.Bytes("google"))
17:02 <+rndbot> SIGTRAP: trace trap Faulting address: 0x0 PC=0x8048a28
base64·*Encoding·Encode+0x54 /home/mgruen/code/go/safe/src/pkg/encodin...
17:03 < exch> :p
17:03 < exch> you br0ke it!
17:05 < rbohn> Yeah, crashes when I build and run on my local system as
well.
17:05 < rbohn> I think there is a problem with the base64 encoder.
17:05 < rbohn> > var msg []byte; base64.URLEncoding.Encode(msg,
strings.Bytes("google"))
17:05 <+rndbot> SIGTRAP: trace trap Faulting address: 0x0 PC=0x8048a28
base64·*Encoding·Encode+0x54 /home/mgruen/code/go/safe/src/pkg/encodin...
17:06 < rbohn> Guess I need to file a defect.
17:09 < exch> 'index out of range'.You are passing a nil slice
17:10 < exch> hmm.  make()-ing it doesnt help much
17:10 < rbohn> @eval strings.Bytes("google")
17:10 <+rndbot> [103 111 111 103 108 101]
17:14 < exch> hmm.  does seem to be broken
17:17 < rbohn> ok I got a test program I can post as an issue.
17:22 < exch> the Encode method has no bounds checking for destination slice
17:22 < exch> bit odd though.  I explicitely create the dest slice with a
size equal to the string's byte array
17:22 < exch> yet it fails on 'dst[1]'
17:22 < rbohn> hmm, crazy bug.
17:26 < exch> after 'if len(src) == 0 { return }' should be another check
for dst.  'if len(dst) == 0 { return }'
17:26 < exch> in src/pkg/encoding/base64/base64.go:71 that is
17:28 < exch> or not
17:28 < exch> he dst array actually reduces in size during the loop
17:29 < exch> in the end it reaches len 1, but the loop still indexes
elements 0 through 3
17:31 < rbohn> I think base64 encoding should always give an array with a
length evenly divisible by 3.
17:31 < rbohn> But it shouldn't blow chunks like this.
17:31 < rbohn> :)
17:31 < exch> indeed :p
17:31 < exch> 'dst = dst[4:len(dst)];'
17:32 < exch> I added 'if len(dst) < 4 { break }' to the top of the loop.
that seems to fix it
17:33 < exch> result of the call is now "Z29v\x00\x00"
17:33 < exch> that seems incorrect
17:34 < rbohn> I think it should fill the trailing zeros with '='.
17:37 < exch> there is code for that in the loop, but it never seems to be
reached
17:41 < rbohn> Posted as issue 273.
17:42 < exch> cool
17:44 < rbohn> Looking back, I don't think the decoder is working.
17:45 < rbohn> I wanted to round-trip a string but it just doesn't work.
17:46 < rbohn> At least the hex decoder works.
17:47 < exch> the encode method cuts off half the stirng
17:47 < exch> "Z29v\x00\x00" instead of "Z29vZ2xl"
17:50 < exch> ah wait.  that may be my fault
17:53 < rbohn> @eval byte64.StdEncoding.EncodedLen(0)
17:53 <+rndbot> <Error: undefined: byte64>
17:53 < rbohn> @eval base64.StdEncoding.EncodedLen(0)
17:53 <+rndbot> 0
17:54 < rbohn> @eval base64.StdEncoding.EncodedLen(1)
17:54 <+rndbot> 4
17:54 < exch> hmm.  seems to work here
17:55 < rbohn> > m := make([]byte, 4); base64.StdEncoding.Encode(m,
strings.Bytes("A"))
17:55 <+rndbot> <no output>
17:55 < exch> > src := strings.Bytes("google"); dst := make([]byte,
(len(src)-1) * 3); base64.URLEncoding.Encode(dst, src);
base64.URLEncoding.Decode(src, dst); fmt.Printf("%#v, %#v", string(dst),
string(src));
17:55 <+rndbot> "Z29vZ2xl\x00\x00\x00\x00\x00\x00\x00", "google"
17:56 < exch> could do with a little less dst length
17:56 < rbohn> @eval base64.StdEncoding.EncodedLen(len("google"))
17:56 <+rndbot> 8
17:57 < rbohn> @eval len("google")
17:57 <+rndbot> 6
17:57 < exch> 2 null bytes?
17:59 < rbohn> 2 byte expansion, leetkey renders it Z29vZ2xl
18:01 < rbohn> > var m []byte; base64.StdEncoding.Decode(m,
strings.Bytes("Z29vZ2xl")); fmt.Print(string(m))
18:01 <+rndbot> SIGTRAP: trace trap Faulting address: 0x0 PC=0x8049447
base64·*Encoding·decode+0x3d3 /home/mgruen/code/go/safe/src/pkg/encodi...
18:01 < exch> m is not initialized
18:01 < rbohn> > m := make([]byte, 6); base64.StdEncoding.Decode(m,
strings.Bytes("Z29vZ2xl")); fmt.Print(string(m))
18:01 <+rndbot> google
18:01 < rbohn> !!!
18:01 < exch> :p
18:02 < rbohn> Guess a good fix is to make sure there is enough room in dst
or bail with an error.
18:03 < exch> indeed
18:04 < exch> that'll brak the api though.  Encode() currently doesnt return
anything.  You'd have to make it return os.Error when dst is too small
18:04 < exch> *break
18:05 < rbohn> Decode returns size, error.  Wonder why they don't do the
same for Encode.
18:10 < exch> Encode would suffice with os.Error
18:11 < exch> http://gopaste.org/oHjoY
18:21 < rbohn> yeah, that's working.
19:04 < Gracenotes> okay.  I'll be going offline for a bit, maybe 3-4 hours,
and I'll be working on rndbot in that time :)
19:05 < Gracenotes> I think there is an argument for hosting it elsewhere,
for sure, i.e.  not my laptop >_> but some security things need work if
that's the case
19:06 < Gracenotes> okay :) goodbye
19:06 <+rndbot> goodbye
19:06 -!- Gracenotes [n=person@wikipedia/Gracenotes] has quit ["Leaving"]
19:06 -!- rndbot [n=bot@wikipedia/Gracenotes] has quit [Remote closed the
connection]
19:44 -!- bquinn [n=bquinn@nat/yahoo/x-xcrvqvknnzbztgla] has quit []
20:56 -!- Netsplit farmer.freenode.net <-> irc.freenode.net quits: exch
20:58 -!- exch [n=nuada@h144170.upc-h.chello.nl] has joined #go-run
20:58 -!- exch [n=nuada@h144170.upc-h.chello.nl] has quit [Remote closed the
connection]
20:58 -!- exch_ [n=nuada@h144170.upc-h.chello.nl] has joined #go-run
21:08 -!- bquinn [n=bquinn@office.velleman.com] has joined #go-run
21:16 -!- Netsplit farmer.freenode.net <-> irc.freenode.net quits: bquinn
21:20 -!- bquinn [n=bquinn@office.velleman.com] has joined #go-run
22:13 -!- XniX23 [n=XniX23@89-212-198-49.dynamic.dsl.t-2.net] has quit [Remote
closed the connection]
22:31 -!- exch [n=nuada@h144170.upc-h.chello.nl] has quit [Remote closed the
connection]
22:32 -!- exch [n=nuada@h144170.upc-h.chello.nl] has joined #go-run
22:50 -!- Gracenotes [n=person@wikipedia/Gracenotes] has joined #go-run
22:50 -!- rndbot [n=bot@wikipedia/Gracenotes] has joined #go-run
23:00 < rbohn> > bot := "need power"
23:00 < rndbot> <no output>
23:02 -!- bquinn [n=bquinn@office.velleman.com] has quit []
23:05 < rbohn> > "no input"
23:05 < rndbot> <Error: "no input" not used, "no input" not used>
23:05 < rbohn> > echo Error
23:05 < rndbot> <Error: syntax error near Error>
23:06 < rbohn> > echo
23:06 < rndbot> <Error: undefined: echo>
23:06 < rbohn> > denifednu
23:06 < rndbot> <Error: undefined: denifednu>
23:08 < rbohn> panic("lost my marbles") would probably be true.
--- Log closed Fri Nov 20 00:00:28 2009