--- Log opened Thu Jul 15 00:00:12 2010
00:03 -!- Agon-laptop
[~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has quit [Remote
host closed the connection]
00:03 -!- i3d [~i3dmaster@216.239.45.130] has joined #go-nuts
00:03 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined
#go-nuts
00:08 -!- photron [~photron@port-92-201-207-183.dynamic.qsc.de] has quit [Ping
timeout: 265 seconds]
00:08 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has joined
#go-nuts
00:14 -!- i3d [~i3dmaster@216.239.45.130] has quit [Quit: leaving]
00:14 -!- i3d [~i3dmaster@216.239.45.130] has joined #go-nuts
00:14 -!- i3d [~i3dmaster@216.239.45.130] has quit [Changing host]
00:14 -!- i3d [~i3dmaster@unaffiliated/i3dmaster] has joined #go-nuts
00:15 -!- GeoBSD [~geobsd@lns-bzn-54-82-251-110-43.adsl.proxad.net] has quit
[Quit: Lost terminal]
00:18 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has quit
[Quit: skelterjohn]
00:21 -!- ExtraSpice [~ExtraSpic@88.118.32.225] has quit [Ping timeout: 240
seconds]
00:23 -!- Wiz126 [~Wiz126@24.229.245.72.res-cmts.sm.ptd.net] has quit [Ping
timeout: 240 seconds]
00:24 -!- Wiz126 [~Wiz126@24.229.245.72.res-cmts.sm.ptd.net] has joined #go-nuts
00:26 -!- carllerche [~carllerch@99.13.242.166] has joined #go-nuts
00:28 -!- carllerche [~carllerch@99.13.242.166] has quit [Client Quit]
00:30 -!- carllerche [~carllerch@99.13.242.166] has joined #go-nuts
00:31 -!- i3d [~i3dmaster@unaffiliated/i3dmaster] has quit [Quit: leaving]
00:32 -!- carllerche [~carllerch@99.13.242.166] has quit [Client Quit]
00:40 -!- g0bl1n [~pr0kter@a213-22-76-1.cpe.netcabo.pt] has joined #go-nuts
00:46 -!- lmoura_ [~lmoura@187.78.165.78] has joined #go-nuts
00:50 -!- sladegen [~nemo@unaffiliated/sladegen] has quit [Ping timeout: 258
seconds]
00:51 -!- sladegen [~nemo@unaffiliated/sladegen] has joined #go-nuts
00:53 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts
00:55 -!- lmoura_ [~lmoura@187.78.165.78] has quit [Ping timeout: 245 seconds]
01:01 -!- htoothrot [~mux@71-8-117-228.dhcp.ftwo.tx.charter.com] has quit [Read
error: Connection reset by peer]
01:12 -!- htoothrot [~mux@71-8-117-228.dhcp.ftwo.tx.charter.com] has joined
#go-nuts
01:12 < plexdev> http://is.gd/dsmcV by [Robert Griesemer] in go/doc/ -- go
spec: clarification of channel close()
01:12 < plexdev> http://is.gd/dsmcZ by [Evan Shaw] in go/lib/codereview/ --
codereview: Fix for Mercurial >= 1.6
01:12 < plexdev> http://is.gd/dsmde by [Russ Cox] in 2 subdirs of go/ --
cgo: various bug fixes
01:12 < plexdev> http://is.gd/dsmdu by [Joe Poirier] in go/src/ -- windows:
append executable extension (done as per Russ' suggestion)
01:13 < plexdev> http://is.gd/dsmdK by [Russ Cox] in go/src/pkg/os/ -- os:
use /tmp again
01:13 < plexdev> http://is.gd/dsmdP by [Brad Fitzpatrick] in 4 subdirs of
go/src/pkg/ -- mime/multipart and HTTP multipart/form-data support
01:19 -!- htoothrot [~mux@71-8-117-228.dhcp.ftwo.tx.charter.com] has quit [Read
error: Connection reset by peer]
01:22 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit:
This computer has gone to sleep]
01:23 -!- htoothrot [~mux@71-8-117-228.dhcp.ftwo.tx.charter.com] has joined
#go-nuts
01:23 -!- Bombe [~droden@weltgehirnmaschine.de] has quit [Changing host]
01:23 -!- Bombe [~droden@freenet/developer/Bombe] has joined #go-nuts
01:39 -!- napsy [~luka@212.235.174.112] has quit [Ping timeout: 240 seconds]
01:50 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.2]
01:56 -!- lmoura_ [~lmoura@187.78.165.78] has joined #go-nuts
01:59 -!- SRabbelier [~SRabbelie@ip138-114-211-87.adsl2.static.versatel.nl] has
quit [Ping timeout: 240 seconds]
02:03 -!- smw [~smw@pool-71-183-88-124.nycmny.fios.verizon.net] has quit [Remote
host closed the connection]
02:06 -!- holmescn [~20526B545@221.192.238.10] has quit [Remote host closed the
connection]
02:31 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined
#go-nuts
02:35 -!- napsy [~luka@212.235.174.112] has joined #go-nuts
02:36 -!- SRabbelier [~SRabbelie@ip138-114-211-87.adsl2.static.versatel.nl] has
joined #go-nuts
02:59 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 276 seconds]
03:15 < plexdev> http://is.gd/dssuc by [Andrew Gerrand] in 2 subdirs of go/
-- release.2010-07-14
03:15 < plexdev> http://is.gd/dssue by [Andrew Gerrand] in go/ --
release.2010-07-14 release
03:20 -!- niemeyer [~niemeyer@201-11-213-235.pltce701.dsl.brasiltelecom.net.br]
has quit [Ping timeout: 240 seconds]
03:29 -!- g0bl1n [~pr0kter@a213-22-76-1.cpe.netcabo.pt] has quit [Quit: I haz a
dreamz...]
03:38 -!- lmoura_ [~lmoura@187.78.165.78] has quit [Ping timeout: 245 seconds]
03:44 < nf> ^ there goes my 100th and 101st commits :)
03:52 -!- cco3 [~conley@c-69-181-138-209.hsd1.ca.comcast.net] has joined #go-nuts
03:57 -!- djm [~djm@paludis/slacker/djm] has quit [Remote host closed the
connection]
04:03 -!- bmizerany [~bmizerany@80.sub-69-99-175.myvzw.com] has quit [Remote host
closed the connection]
04:09 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Ping timeout: 252
seconds]
04:20 -!- Ginto8 [~ginto8@pool-72-82-235-34.cmdnnj.fios.verizon.net] has quit
[Ping timeout: 265 seconds]
04:27 -!- GoBIR [~gobir@DHCP-159-138.caltech.edu] has quit [Ping timeout: 260
seconds]
04:30 -!- GoBIR [~gobir@DHCP-159-138.caltech.edu] has joined #go-nuts
04:36 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts
04:39 -!- napsy [~luka@212.235.174.112] has quit [Ping timeout: 248 seconds]
04:46 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
04:53 -!- Ginto8 [~ginto8@pool-72-82-235-34.cmdnnj.fios.verizon.net] has joined
#go-nuts
04:59 -!- scm [justme@d070120.adsl.hansenet.de] has quit [Ping timeout: 258
seconds]
05:00 -!- itrekkie [~itrekkie@ip70-190-110-124.ph.ph.cox.net] has joined #go-nuts
05:01 -!- scm [justme@d038067.adsl.hansenet.de] has joined #go-nuts
05:03 -!- itrekkie [~itrekkie@ip70-190-110-124.ph.ph.cox.net] has quit [Client
Quit]
05:06 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit:
This computer has gone to sleep]
05:13 -!- antileet [~anirudhs@59.92.137.116] has joined #go-nuts
05:15 -!- napsy [~luka@212.235.174.112] has joined #go-nuts
05:19 -!- Sacho [~sacho@87-126-51-231.btc-net.bg] has quit [Quit: Leaving]
05:25 < nsf> god..  why I have bought this "mini" keyboard, I can't type now
:(
05:30 -!- antileet [~anirudhs@59.92.137.116] has quit [Ping timeout: 245 seconds]
05:34 -!- belkiss [~belkiss@drn13-1-78-235-168-105.fbx.proxad.net] has joined
#go-nuts
05:36 < str1ngs> design question.  I'm using ForkExec which returns a bunch
of file paths.  problem I'm having is figuring out how to get all of that into a
slice.
05:37 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
05:39 -!- Tiger [~chatzilla@118.126.12.53] has joined #go-nuts
05:41 -!- Tiger_ [~chatzilla@118.126.12.53] has quit [Ping timeout: 258 seconds]
05:42 -!- GoBIR [~gobir@DHCP-159-138.caltech.edu] has quit [Ping timeout: 260
seconds]
05:42 -!- Eko [~eko@DHCP-159-138.caltech.edu] has quit [Ping timeout: 260 seconds]
05:43 -!- Eko [~eko@DHCP-159-138.caltech.edu] has joined #go-nuts
05:43 < Ginto8> str1ngs, are the filepaths in string form?
05:43 -!- antileet [~anirudhs@59.96.64.228] has joined #go-nuts
05:43 < Ginto8> if so use a StringVector and Push() (or PushBack() I forget
what it's called exactly)
05:44 < str1ngs> yes there in string form
05:44 < str1ngs> reader.ReadString('\n')
05:44 -!- GoBIR [~gobir@DHCP-159-138.caltech.edu] has joined #go-nuts
05:44 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.2]
05:44 < Ginto8> kthen
05:44 < str1ngs> so read the bufio that then push into a string vector?
05:44 < Ginto8> use a StringVector
05:44 < Ginto8> yep
05:45 < str1ngs> ah ok thank you
05:45 < Ginto8> and then you can do []string(sv) where sv is a StringVector
05:45 < str1ngs> eventualy I need to do some logic on the patch and then put
the metadata into a type.
05:45 < str1ngs> path*
05:46 < Ginto8> ok well you can convert each one into a []byte (so that you
can edit them), mess with em, then convert them back to a string and put em back
05:46 < Ginto8> or you could do a [][]byte
05:46 < Ginto8> but then you'd have to do the reallocations yourself
05:48 < str1ngs> I need need to change the values of the paths.  I think
string vector should be enough to work with
05:49 < Ginto8> okey dokey
05:49 < str1ngs> that helps alot.  I'm not use to stuff this low level.
05:50 < Ginto8> well, I wouldn't call Go low-level
05:50 < Ginto8> well not compared to C/++ at least
05:50 < Ginto8> it's one level higher
05:50 < str1ngs> oh yes thats for sure
05:50 < str1ngs> but compared to system in ruby.
05:50 < Ginto8> oh yeah
05:50 < str1ngs> ForkExec is more work.
05:51 < Ginto8> well yes, but it's also more useful overall
05:51 < str1ngs> but the pipes are really nice
05:51 < Ginto8> out of curiosity, what are you using forkexec for?
05:52 < Ginto8> if it's just doing more than one thing at a time, goroutines
and channels are a far better solution than forkexec and pipes
05:52 < str1ngs> I need find some files then pull meta data out of the files
05:52 < str1ngs> I dould have done it in pure go but I'm still new to go.
05:53 < Ginto8> look through the GoDayX.pdf in $GOROOT/doc
05:53 -!- adu [~ajr@softbank220043138128.bbtec.net] has joined #go-nuts
05:53 < str1ngs> I'll pastbin some code
05:53 < Ginto8> it'll familiarize you with all the core concepts
05:54 < str1ngs> http://codepad.org/3cttxQWU
05:54 -!- cco3 [~conley@c-69-181-138-209.hsd1.ca.comcast.net] has quit [Ping
timeout: 264 seconds]
05:54 < Ginto8> oh you're usin find
05:54 < str1ngs> yes
05:55 < Ginto8> listing all installed packages so that you can check for
necessary libs?
05:55 < Ginto8> or just for learning experience
05:55 < Ginto8> ?
05:55 < str1ngs> I'm building a web based build system
05:56 < Ginto8> ooh that sounds interesting
05:56 < str1ngs> bash would be better since the PKGBUILD are just bash files
05:56 < Ginto8> hm
05:57 < str1ngs> and it holds meta data.  so I plan to say pull the data and
put into int say a type called pack
05:57 < str1ngs> pack.Name().  returns the package name that sorta thing
05:57 < Ginto8> hm ok
05:57 < str1ngs> but really its for learning
05:58 < Ginto8> ok cool
06:00 < str1ngs> I also like go interfaces.  with out the OO bloat
06:01 -!- drry [~drry@unaffiliated/drry] has quit [Ping timeout: 264 seconds]
06:01 -!- drry [~drry@unaffiliated/drry] has joined #go-nuts
06:01 < jer> i'm disappointed with go's interfaces...  nobody gets OO right
anymore.  OO isn't about objects really, it's all about messages.  unfortunately
too many languages think either 1) objects should be avoided at all costs, or 2)
messages are only a way of linking objects, rather than the other way around --
objects are merely endpoints for messages
06:02 < Ginto8> jer, seriously?  interfaces aren't what makes go go.
06:02 < Ginto8> goroutines are the main thing
06:02 < jer> Ginto8, i know
06:02 < str1ngs> I agree about the go routines
06:02 < Ginto8> interfaces are just something useful
06:02 < jer> there's a reason i actually do right go code =]
06:02 < Ginto8> and anyway, OO is too abstract a concept
06:02 < Ginto8> Go is based on C
06:03 * jer is familiar with the guiding principals behind Go design, and i don't
object
06:03 < Ginto8> well interfaces are just a way of abstracting structs
without having to deal with the hell that is template metaprogramming
06:03 < str1ngs> thats the way I look at it.
06:03 < Ginto8> they aren't intended to be an OO feature
06:04 < Ginto8> I don't even think of Go as an OO language really
06:04 < jer> sure, i don't use go for it's OO features =]
06:05 < Ginto8> it's a procedural/structural language with a focus on
parallelism that has some fancy stuff for dealing with data
06:05 < Ginto8> "fancy stuff" being methods and interfaces
06:05 < Namegduf> It has abstraction.
06:05 < Ginto8> Namegduf, that's still fancy stuff
06:05 < Ginto8> =P
06:05 < jer> goroutines are nothing new though, been using languages with
coroutines for almost a decade now; goroutines aren't all that much different
06:05 -!- Eridius [~kevin@unaffiliated/eridius] has quit [Ping timeout: 246
seconds]
06:06 < jer> that said, without some form of easy to use concurrency, i'd
have not even bothered with go
06:06 < Ginto8> jer, yes, but for a systems programming language based on C?
it's a major step forward (that should have happened a while ago, but regardless)
06:06 < jer> any language that can't do that these days, regardless of its
target, is not worth using
06:07 < Ginto8> well is less worth using
06:07 < Ginto8> C/++ still have a number of strong points
06:07 < Namegduf> Noting that pretty much every popular high-level language
nowadays at least outside of functional or special use stuff that has coroutines
does not multiplex them across threads
06:07 < Ginto8> there IS a reason they're still industry standard for most
things
06:07 < jer> Ginto8, well, been using coroutines in C for longer than 10
years =] just a royal pain in the ass having to implement them yourself in an
platform specific manner =/
06:07 < Ginto8> jer, good point
06:08 < Ginto8> Namegduf, that is actually something very worthwhile to note
06:08 < jer> about 60% of my code written these days is still C or ObjC
(iphone/mac dev)
06:08 < Ginto8> goroutines take advantage of both multicore processors and
os threads, while not relying too heavily on either
06:08 < jer> Namegduf, that's right, but you don't always need to.
06:08 < Ginto8> and that's they're greatest advantage
06:08 < str1ngs> anyways I didnt mean to cause a debate.  but for me go is a
step closer to C from ruby.  with garbage collection and all that good stuff.
06:09 -!- napsy [~luka@212.235.174.112] has quit [Quit: Lost terminal]
06:09 < Namegduf> jer: I consier it a valuable feature nevertheless, and it
does extend the use of the concurrency
06:09 < Ginto8> str1ngs, Go is more likely a step closer to Python from C
06:09 < jer> in a language like go, you really have to.  but other
languages, like your interpreted languages, tend to (if done right) allow you to
create many instances of themselves, containing the environment within itself
06:09 < Ginto8> hm good point
06:09 < jer> in those cases, where that ability is present, multiplexing
across OS threads is just silly
06:09 < Namegduf> Specifically, even single-threaded Go will push goroutines
that block on external stuff off
06:09 < Ginto8> but easy IPC between those environments?
06:09 < Namegduf> Er, no, it's required.
06:09 < jer> Ginto8, more complex yes
06:10 < Namegduf> If they do what Go does, they will use multiple threads or
processes
06:10 < Ginto8> yep
06:10 < Namegduf> There's no way (I know of) to block on syscalls and C
functions without blocking the rest of the program, without threading
06:10 < Ginto8> yep
06:11 * Ginto8 really loves the C interfacing
06:11 < chressie> str1ngs: i just looked at your pasted code and it's
probably less pain if you use exec.Run instead of os.ForkExec (at leas less typing
:) )
06:11 < Ginto8> it means that I don't have to deal with any mucky bindings
06:11 < jer> that's one thing i haven't looked at seriously yet; a cursory
glance has me thinking i have to write C glue code in comments
06:11 < jer> but hopefully i'm wrong
06:11 < Ginto8> jer, nope
06:12 < Ginto8> just #include's
06:12 < jer> ah
06:12 < Ginto8> you actually can't do anything else
06:12 < Ginto8> o.o
06:12 < Namegduf> cgo is somewhat painful in implementation because
goroutines require it for the details of their operation
06:12 < Ginto8> I tried to make constants, but it was ignored by cgo
06:12 < Ginto8> Namegduf, huh?
06:12 < jer> strong FFI, and easy to use concurrency are (in my mind)
requirements for any new language made in the last few years
06:13 < jer> there's no way to call into go code from C code is there?
06:13 < Ginto8> nope
06:13 < jer> its just one way is it not?
06:13 < jer> that's what i thought i read
06:13 < str1ngs> chressie: ok I'll check exec.Run out.
06:13 < Namegduf> Ginto8: Segmented stacks make Go functions have different
calling conventions to C functions
06:13 < Ginto8> mainly because of the difference in typing systems
06:13 < Namegduf> Which is why cgo is complex
06:13 < Namegduf> And why making Go be called from C is hard
06:13 < Ginto8> hm yeah
06:13 < str1ngs> chressie: I'm guessing thats what I was looking for.
something like system in ruby
06:13 < Ginto8> Namegduf, nigh impossible
06:14 < chressie> str1ngs: yeah, no need for bufio and stuff, it all happens
implicitly
06:17 < str1ngs> so I would just use cmd.Stdout then?
06:17 < Ginto8> cmd.Stdout?
06:17 < chressie> exactly
06:18 < str1ngs> ah ok gotcha
06:18 < str1ngs> and my guess is its already buffered?
06:18 < Ginto8> you mean fmt.Print[f|ln]()?
06:19 -!- adu [~ajr@softbank220043138128.bbtec.net] has quit [Quit: adu]
06:19 < chressie> i think (at least at the os level)
06:19 < chressie> Ginto8: we're talking about exec.Run
06:20 < Ginto8> <str1ngs> so I would just use cmd.Stdout then?
06:20 < Ginto8> ^ that's what I was talkin about
06:20 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
06:20 < chressie> Ginto8: yes, the result of exec.Run is a Cmd struct, which
has a field Stdout
06:21 < Ginto8> oh
06:21 < Ginto8> ok then
06:21 < Ginto8> lol sorry
06:21 < chressie> nothing to excuse :)
06:21 < str1ngs> chressie: I'm looking at the exec_test.go see how they do
it . ya this is easier
06:22 < str1ngs> mainly ioutil.ReadAll(cmd.Stdout)
06:23 < chressie> you mean io.ReadFull(cmd.Stdout) :)
06:23 < str1ngs> oh no need for ioutil then?
06:23 < chressie> ioutil is for files that you specify with a string
06:23 < chressie> (i.e.  in the filesystem)
06:24 < str1ngs> ah ok thanks again
06:24 < Ginto8> actually ioutil.ReadAll reads from an io.Reader
06:24 < Ginto8> but it goes until there's an eof so...
06:24 < str1ngs> ya it doesnt do what I thought it did hehe
06:25 < chressie> huh...  yeah sorry, i thought about ReadFile...  but
you're right
06:25 < Ginto8> ReadFile?
06:25 < Ginto8> what package is that from?
06:25 -!- acetoline [~alireza@125-237-190-240.jetstream.xtra.co.nz] has joined
#go-nuts
06:26 < chressie> ioutil.ReadFile
06:26 < Ginto8> oh
06:26 < Ginto8> didn't see that one there =P
06:26 < Ginto8> hm
06:26 < Ginto8> ioutil is pretty useful
06:26 < str1ngs> ReadALl works
06:27 < chressie> great!
06:27 < str1ngs> for what I need anyways
06:27 < Ginto8> wait readall works?
06:27 -!- bortzmeyer [~bortzmeye@batilda.nic.fr] has joined #go-nuts
06:27 < str1ngs> returns everthing as []byte
06:27 < Ginto8> you mean readfull with a buffer
06:27 < Ginto8> yeah but it reads until eof
06:27 < Ginto8> I dont think an stdout will have an eof
06:27 < str1ngs> which is fine
06:27 < str1ngs> stdout has and EOF
06:27 < Ginto8> no it isn't
06:27 < Ginto8> oh it does?
06:27 < Ginto8> oh right when the process closes
06:27 < Ginto8> sorry
06:28 < str1ngs> no worries
06:28 < Ginto8> though it mighta been better to use like fmt.Fscan or w/e
cuz now you're gonna have to use fmt.Sscan anyway
06:29 < str1ngs> I can split on \n
06:29 < Ginto8> via fmt.Sscanln?
06:29 < str1ngs> or maybe there is a better way.  I'm use to stuff like
ReadLine
06:30 < Ginto8> check out fmt
06:30 < chressie> or use bytes.Split
06:30 < Ginto8> all of the above
06:30 < Ginto8> there are so many choices
06:30 < str1ngs> ya I guess thats why I've been asking .
06:31 < Ginto8> fmt.Fscan[f|ln] is probly your best choic
06:31 < Ginto8> choice*
06:34 < chressie> Ginto8: if you just need to split at a special character,
why not use {strings,bytes}.Split() function?
06:35 < Ginto8> hm I guess so but he'll still end up using fmt.Sscan[f|ln]
06:38 < str1ngs> I dont think so Ginto I just need to take stdout read
eachline and put into a something
06:38 < str1ngs> unless I'm misreading what Sscan does
06:39 < Ginto8> yeah but fmt.Sscanln has the annoying aspect of really only
treating newline as whitespace
06:39 < Ginto8> if it doesn't read all the stuff in from that line, the rest
of the line stays
06:39 < Ginto8> so you probably want to do bytes.Split then fmt.Sscan[f|ln]
06:40 < str1ngs> unless I can pass an array as the interface?  thats whats
confusing me
06:40 < str1ngs> or slice rather
06:40 < Ginto8> you can take a slice of the whole array and pass it
06:41 < str1ngs> I dont need to modify the file path just create an array or
slice of them
06:46 -!- tvw [~tv@212.79.9.150] has joined #go-nuts
06:52 -!- napsy [~luka@193.2.66.101] has joined #go-nuts
07:04 < str1ngs> chressie: ya thats much better.
http://codepad.org/ic76sGf6
07:04 < chressie> str1ngs: if you want to solve your problem "the go way"
you could do something like http://gist.github.com/476610
07:04 < str1ngs> I'm still not sure of something like the string conversion
and println
07:06 < chressie> str1ngs: yes, looks much better :) (but you must provide
"/usr/bin/find" as first argument in args as well)
07:07 < str1ngs> ya I'm still sure why that needs to be done.
07:07 < str1ngs> but backtracking . your go implemention is way better then
this.
07:08 < chressie> the path.Walk mechanism is more powerful and less pain
than using find :)
07:08 -!- Chinainvent [~chinainve@121.0.29.199] has joined #go-nuts
07:09 < str1ngs> holy smokes so ya all I have to do is provide VisitDir
VisitFile
07:09 < str1ngs> this really helps thank you
07:11 < chressie> pleasure :)
07:12 < str1ngs> on the bright side I did learn alot about forks
07:14 < exch> more useful than spoons
07:14 < str1ngs> v2 will have sporks so look out
07:14 < chressie> definitly...  and available in go ;)
07:15 < str1ngs> also should I putting my structs and attached functions
into a module?
07:15 < str1ngs> err package
07:15 < Ginto8> yes
07:15 < Ginto8> they have to be
07:15 < Ginto8> even main() has to be in a package
07:15 < Ginto8> (package main, specifically)
07:16 < str1ngs> I guess I can make something called utils.go for now and if
something gets larger move it to a real package
07:18 < exch> really no need to put it in separate packages, unless it's
going to be shared among multiple projects
07:19 < str1ngs> http://gist.github.com/476610 well for this V struct for
example
07:19 < str1ngs> I could have that in my main package but.  it would get
mess so do I make a package just for that?
07:20 < exch> a seperate go file to put it in should be enough
07:20 < exch> v.go perhaps?
07:20 < str1ngs> ah ok thanks
07:21 < exch> '$ 6g main.go v.go foo.go bar.go' <- easy enough to compile
multiple files into the same binary
07:21 < Ginto8> exch, also the awesome easy makefile system
07:21 < exch> or that
07:21 < Ginto8> especially helpful for when I'm using cgo
07:22 < str1ngs> no thats fine.  I'v been strugging with go desing concepts
this clears it up for me.
07:22 < str1ngs> design*
07:23 < exch> note that the v.go file should also have the 'package main'
header.  The code is in a separate file, but it's still part of the same program
after all
07:23 < str1ngs> ah ok
07:24 < str1ngs> I dont think I've had this much fun with a language in
awhile.
07:24 -!- belkiss [~belkiss@drn13-1-78-235-168-105.fbx.proxad.net] has quit [Quit:
KVIrc Equilibrium 4.1.0, revision: 4632, sources date: 20100519, built on:
2010-07-09 07:13:47 UTC http://www.kvirc.net/]
07:25 -!- djm [~djm@paludis/slacker/djm] has joined #go-nuts
07:26 -!- iant [~iant@62.20.124.50] has joined #go-nuts
07:26 -!- mode/#go-nuts [+v iant] by ChanServ
07:27 -!- path[l] [UPP@120.138.102.50] has quit [Quit: path[l]]
07:29 -!- mxweas [~max@c-98-225-102-170.hsd1.az.comcast.net] has quit [Quit: Mac
has gone to sleep]
07:29 -!- Fish-Work [~Fish@86.65.182.207] has quit [Remote host closed the
connection]
07:29 -!- Fish-Work [~Fish@86.65.182.207] has joined #go-nuts
07:33 < exch> I'm curious why a the file descriptor for any file opened with
os.Open() is always 3
07:34 < napsy> it probaly increases on every Open()
07:34 -!- sioraiocht [~tomh@unaffiliated/sioraiocht] has joined #go-nuts
07:35 < exch> possibly
07:36 < napsy> it should
07:37 < Ginto8> exch, 0 1 and 2 are stdout, stdin, and stderr, not
necessarily in that order
07:37 < mpl> can anyone remind me what's roger peppe nick here please?
something starting with "w" I think?
07:37 < exch> durr, I was misreading my own code so got a tad confused
there.  Makes sense that it does.
07:37 < Ginto8> check the docs of package os if you wanna know which ones
they are
07:38 < exch> it's ok.  Figured it out now :)
07:38 < exch> Was looking at some old test code I made a while back.  it
passes an open file descriptor from one process to another.
07:39 < Ginto8> it doesn't just pass an os.File or an io.ReadWriter?
07:39 < exch> Don't think I actually got to the point of testing what I
really wanted to test though.  At the time I was wondering if it was possible to
share an open tcp connection with forked child processes
07:39 < exch> Nope, just the fd
07:39 < Ginto8> hm
07:40 < exch> if open tcp sockets are the same as files on linux, then it
should work
07:40 < exch> http://gist.github.com/476631
07:41 < exch> that basically opens a new file.  writes a count to it.  then
forks itself, passes the open file fd and closes..  the new instance does the
same..  rinse and repeat
07:41 < exch> incrementing the count on every cycle
07:41 < Ginto8> oh so it treats an open file descriptor as a pipe
07:41 < Ginto8> sorta
07:42 < exch> something like that, yea I suppose you could look at it that
way
07:42 < str1ngs> chressie: I was looking at the path.Walk code and if you
dont provide VistDir it wont walk directories
07:44 < exch> The solution is rather simple, but go couldnt do it with the
standard os.Open() call since it passes CLOEXEC to syscall.open().  This will
explicitely close and and all files opened by the current process when it is
killed.  The openForkSafe() function in that gist does what os.Open() does, except
without the CLOEXEC flag.
07:47 -!- sioraiocht [~tomh@unaffiliated/sioraiocht] has quit [Remote host closed
the connection]
07:48 -!- akanton [5ae72cd0@gateway/web/freenode/ip.90.231.44.208] has joined
#go-nuts
07:49 -!- General13372 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has joined
#go-nuts
07:50 -!- path[l] [~path@59.162.86.164] has joined #go-nuts
07:50 -!- General1337 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has quit
[Ping timeout: 276 seconds]
07:52 -!- ikaros [~ikaros@drms-4d015b9e.pool.mediaWays.net] has joined #go-nuts
08:21 < chressie> str1ngs: no, you _need_ to provide VisitDir _and_
VisitFile, otherwise the struct will not satisfy the Visitor interface and you
would get a compile time error
08:22 < str1ngs> realy hmm I'll check it out
08:22 < str1ngs> if !v.VisitDir(path, f) I thought checked for that
08:22 < chressie> the traversing depends on the return value of VisitDir
08:23 < str1ngs> yep you are right
08:23 < chressie> this if statement does not check for existence, but for
return value
08:23 < str1ngs> but I think I need a os.Error channel because it doesnt
walk symlinks
08:25 < chressie> a symlink is not a directory so you probably need to
follow the symlink in the VisitFile code..  i'll look into it
08:26 < str1ngs> ah ok thats good then
08:26 < str1ngs> I can probably figure it out.  you have help more then
enough.
08:28 -!- lmoura_ [~lmoura@187.78.165.78] has joined #go-nuts
08:29 -!- smw [~smw@pool-71-183-88-124.nycmny.fios.verizon.net] has joined
#go-nuts
08:29 -!- photron [~photron@port-92-201-19-68.dynamic.qsc.de] has joined #go-nuts
08:31 -!- sauerbraten [~sauerbrat@p508CFA36.dip.t-dialin.net] has joined #go-nuts
08:33 -!- ExtraSpice [~ExtraSpic@88.118.32.225] has joined #go-nuts
08:33 -!- antileet [~anirudhs@59.96.64.228] has quit [Ping timeout: 240 seconds]
08:45 -!- antileet [~anirudhs@59.96.33.27] has joined #go-nuts
08:53 -!- General13372 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has quit
[Ping timeout: 258 seconds]
08:57 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined
#go-nuts
08:59 -!- Wiz126 [~Wiz126@24.229.245.72.res-cmts.sm.ptd.net] has quit [Ping
timeout: 248 seconds]
09:00 -!- General1337 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has joined
#go-nuts
09:02 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller,
Faster, Easier.  http://miranda-im.org]
09:05 -!- Wiz126 [~Wiz126@24.229.245.72.res-cmts.sm.ptd.net] has joined #go-nuts
09:08 -!- mat_ [~mat@mx3.absolight.net] has quit [Ping timeout: 248 seconds]
09:14 -!- Netsplit *.net <-> *.split quits: djm, araujo, nictuku, acetoline,
ExtraSpice, Eko, General1337, XenoPhoenix, Soultaker, Rennex_, (+22 more, use
/NETSPLIT to show all of them)
09:14 -!- Netsplit *.net <-> *.split quits: scm, drhodes, DJCapelis,
bechmoul, tvw, vrtical, zeroXten, atsampson, ampleyfly, plexdev, (+45 more, use
/NETSPLIT to show all of them)
09:15 -!- Netsplit *.net <-> *.split quits: SecretAgent, jA_cOp, Boney, aho,
maht, akanton, temoto, Zoopee, Arimoto, cw, (+44 more, use /NETSPLIT to show all
of them)
09:15 -!- Netsplit over, joins: ExtraSpice, SRabbelier, shawn_, tsung, Fish-Work,
maht, soul9, mpl, Zoopee, __20h__ (+131 more)
09:16 -!- mat_ [~mat@mx3.absolight.net] has joined #go-nuts
09:20 < exch> I should write some Go bindings for DirectFB.  This project is
turning out to be most interesting
09:21 -!- Tiger [~chatzilla@118.126.12.53] has quit [Ping timeout: 260 seconds]
09:22 -!- akanton [5ae72cd0@gateway/web/freenode/ip.90.231.44.208] has quit [Quit:
Page closed]
09:27 -!- lmoura_ [~lmoura@187.78.165.78] has quit [Ping timeout: 245 seconds]
09:32 -!- dju [dju@fsf/member/dju] has quit [Ping timeout: 265 seconds]
09:33 -!- antileet [~anirudhs@59.96.33.27] has quit [Ping timeout: 240 seconds]
09:35 -!- dju [dju@fsf/member/dju] has joined #go-nuts
09:35 -!- dju [dju@fsf/member/dju] has quit [Read error: Connection reset by peer]
09:36 -!- dju [dju@fsf/member/dju] has joined #go-nuts
09:37 -!- dju [dju@fsf/member/dju] has quit [Read error: Connection reset by peer]
09:37 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.2]
09:38 -!- dju [dju@fsf/member/dju] has joined #go-nuts
09:43 < str1ngs> chressie: path.Walk uses Lstat which imo is good or it
would have to do alot of checking for recursion
09:44 < str1ngs> but I guess I could test for a symlink VisitFile but not
sure how to test for file and symlink.  and they call path.walk using that as the
root?
09:44 < str1ngs> err directory and symlink
09:46 -!- Wi11 [~william@dhcp-0-14-bf-38-80-9c.cpe.powergate.ca] has quit [Ping
timeout: 260 seconds]
09:47 -!- antileet [~anirudhs@59.92.199.191] has joined #go-nuts
09:49 -!- dju [dju@fsf/member/dju] has quit [Ping timeout: 260 seconds]
09:53 -!- Wi11 [~william@dhcp-0-14-bf-38-80-9c.cpe.powergate.ca] has joined
#go-nuts
09:56 < chressie> str1ngs: yeah something like that..  i'll try it later as
well, because i'm interested in that issue too ;)
10:02 < str1ngs> I think I almost have it
10:04 < str1ngs> puesdo . if file is symlink and Stat file does not error or
possibly contains more the 1 entry.  and file is not followsymlink path.walk file
10:05 < str1ngs> hopefully that made sense
10:07 -!- Wi11 [~william@dhcp-0-14-bf-38-80-9c.cpe.powergate.ca] has quit [Ping
timeout: 246 seconds]
10:07 -!- abiosoft [~abiosoft@2002:299b:10f6:d:219:7eff:fe8f:1f59] has joined
#go-nuts
10:08 -!- General1337 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has quit
[Ping timeout: 240 seconds]
10:08 -!- General13372 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has joined
#go-nuts
10:14 -!- Wi11 [~william@dhcp-0-14-bf-38-80-9c.cpe.powergate.ca] has joined
#go-nuts
10:15 -!- boscop [~boscop@g225201127.adsl.alicedsl.de] has joined #go-nuts
10:19 -!- [Pete_27] [~noname@115-64-1-61.static.tpgi.com.au] has joined #go-nuts
10:28 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Read
error: Connection reset by peer]
10:29 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined
#go-nuts
10:41 -!- antileet [~anirudhs@59.92.199.191] has quit [Ping timeout: 260 seconds]
10:44 -!- MizardX [~MizardX@unaffiliated/mizardx] has joined #go-nuts
10:53 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
10:54 -!- General1337 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has joined
#go-nuts
10:55 -!- napsy [~luka@193.2.66.101] has quit [Ping timeout: 240 seconds]
10:56 -!- General13372 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has quit
[Ping timeout: 240 seconds]
11:05 -!- jA_cOp [~yakobu@unaffiliated/ja-cop/x-9478493] has quit [Quit: Leaving]
11:07 -!- belkiss [~belkiss@drn13-1-78-235-168-105.fbx.proxad.net] has joined
#go-nuts
11:12 -!- abiosoft [~abiosoft@2002:299b:10f6:d:219:7eff:fe8f:1f59] has quit [Ping
timeout: 252 seconds]
11:14 -!- Meidor [~quassel@piggy.cs.ru.nl] has joined #go-nuts
11:18 < str1ngs> chressie: got it http://gist.github.com/476831
11:23 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
11:27 < str1ngs> but imo path.Walk should us os.Stat vs os.LStat and test
for f.FollowedSymlink in path.walk.  however this might very well be the intention
because avoids the possibility for recursion.  and forces symlink handling to be
done in VisitFile
11:31 -!- abiosoft [~abiosoft@2002:299b:10f6:d:219:7eff:fe8f:1f59] has joined
#go-nuts
11:34 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
11:37 -!- artefon [~thiagon@150.164.2.20] has joined #go-nuts
11:41 -!- path[l] [~path@59.162.86.164] has quit [Quit: path[l]]
11:42 -!- path[l] [~path@59.162.86.164] has joined #go-nuts
11:54 -!- Fish-Work [~Fish@86.65.182.207] has quit [Read error: Connection reset
by peer]
11:54 -!- Fish-Work [~Fish@86.65.182.207] has joined #go-nuts
11:55 -!- Shyde [~Shyde^^@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de]
has joined #go-nuts
12:00 -!- belkiss [~belkiss@drn13-1-78-235-168-105.fbx.proxad.net] has quit [Quit:
KVIrc Equilibrium 4.1.0, revision: 4632, sources date: 20100519, built on:
2010-07-09 07:13:47 UTC http://www.kvirc.net/]
12:03 -!- alehorst [~alehorst@187.58.237.20] has joined #go-nuts
12:03 < sauerbraten> does someone have an example how to send a normal HTTP
request, for example getting www.google.com?
12:05 < jnwhiteh> http://paste2.org/p/915582
12:06 < jnwhiteh> taken out of context, but that's one way =)
12:07 < sauerbraten> w00t, that simple?  :) that's quite nice, thank you...
i was reading the pkg http abot Conn types and Requests types and got confused :/
12:12 < jnwhiteh> nope, that's all you need (for right now)
12:13 < jnwhiteh> the http package is going to be re-done, it may be
slightly diff then.
12:13 < jnwhiteh> who knows )
12:14 -!- path[l] [~path@59.162.86.164] has quit [Quit: path[l]]
12:15 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
12:16 -!- path[l] [~path@59.162.86.164] has joined #go-nuts
12:17 < sauerbraten> someone here has experience with json?
12:20 < MizardX> sauerbraten: Not exactly json, but has a similar interface:
http://research.swtch.com/2009/12/data-structures-go-programs.html
12:24 < sauerbraten> what's the difference between json.Decode() and
json.Unmarshal?
12:30 -!- niemeyer [~niemeyer@201-11-213-235.pltce701.dsl.brasiltelecom.net.br]
has joined #go-nuts
12:31 < MizardX> It seems Decode to work on io.Reader, while Unmarshal works
on []byte
12:31 < MizardX> It seems Decode works on io.Reader, while Unmarshal works
on []byte
12:33 < sauerbraten> ok and what about that interface?  how do i make one
that fits to the json file i get?
12:33 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has joined
#go-nuts
12:36 -!- GeoBSD [~geobsd@lns-bzn-54-82-251-110-43.adsl.proxad.net] has joined
#go-nuts
12:37 -!- artefon [~thiagon@150.164.2.20] has quit [Ping timeout: 264 seconds]
12:37 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined
#go-nuts
12:40 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Quit: WeeChat
0.3.2]
12:47 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has quit
[Quit: skelterjohn]
12:47 < chressie> str1ngs: using Lstat ist definitly the reason to avoid
recursion
12:47 -!- dju [dju@fsf/member/dju] has joined #go-nuts
12:47 < chressie> unfortunately your version is affected by recursion as
well
12:49 -!- mbarkhau [~koloss@dslb-088-068-251-010.pools.arcor-ip.net] has joined
#go-nuts
12:50 -!- GeoBSD [~geobsd@lns-bzn-54-82-251-110-43.adsl.proxad.net] has quit [Ping
timeout: 264 seconds]
12:50 -!- GeoBSD [~geobsd@lns-bzn-21-82-64-67-122.adsl.proxad.net] has joined
#go-nuts
12:50 -!- Agon-laptop
[~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has joined
#go-nuts
12:52 -!- dju [dju@fsf/member/dju] has quit [Read error: Connection reset by peer]
12:52 -!- dju [dju@fsf/member/dju] has joined #go-nuts
12:56 < str1ngs> yes I noticed that too
12:57 < str1ngs> luckly I dont have have recursive links but..  still
something I cant avoid unless I have access to the file pointers
12:59 -!- gid [~gid@220.253-225-62.VIC.netspace.net.au] has joined #go-nuts
13:00 -!- mlip [~mlip@62.218.44.194] has joined #go-nuts
13:00 -!- mlip [~mlip@62.218.44.194] has left #go-nuts []
13:01 < str1ngs> but imo f.IsDirectory() with os.Lstat makes this package
incomplete.  since you pretty much have to write your own walk to work with
symlinks
13:01 -!- Chinainvent [~chinainve@121.0.29.199] has quit [Quit: Leaving]
13:06 -!- dju [dju@fsf/member/dju] has quit [Read error: Connection reset by peer]
13:07 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts
13:29 -!- abiosoft [~abiosoft@2002:299b:10f6:d:219:7eff:fe8f:1f59] has quit [Ping
timeout: 260 seconds]
13:32 < chressie> i've updated http://gist.github.com/476610 to a version
that (correctly?) traverses a file hierarchy and skips cycles (just a dirty hack,
can probably be implemented more efficient)
13:34 -!- Linnk [~Linnk@ip-56-115.bnaa.dk] has joined #go-nuts
13:35 < str1ngs> ya my take is that it should be included in path.Walk.
since calling path.Wal inside VisitFile seems odd
13:36 -!- aho [~nya@fuld-4d00d22e.pool.mediaWays.net] has quit [Ping timeout: 245
seconds]
13:36 -!- aho [~nya@fuld-4d00d2ef.pool.mediaWays.net] has joined #go-nuts
13:38 < chressie> yep i understand your concerns
13:38 -!- artefon [~thiago@dhcp46.usuarios.dcc.ufmg.br] has joined #go-nuts
13:40 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.2]
13:40 -!- kw- [~aevirex@d86-32-213-87.cust.tele2.at] has joined #go-nuts
13:41 < str1ngs> which is fine.  but if I read the new gist right.  it uses
os.Stat to get the real dir file pointer.  and VistDir flags visited to avoid
recursion?
13:41 < chressie> exactly
13:42 < str1ngs> nice I didnt think about adding that to struct
13:43 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit:
This computer has gone to sleep]
13:43 -!- alehorst [~alehorst@187.58.237.20] has quit [Ping timeout: 248 seconds]
13:43 < str1ngs> this has come along from my find implimentation hehe
13:44 < chressie> :)
13:48 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has joined
#go-nuts
13:53 -!- acetoline [~alireza@125-237-190-240.jetstream.xtra.co.nz] has quit
[Quit: Lost terminal]
13:53 < sauerbraten> how do i use json.Unmarshal() correctly?  what's meant
with v interface{} in http://golang.org/pkg/json/#Unmarshal
13:55 -!- ako [~nya@fuld-4d00d38e.pool.mediaWays.net] has joined #go-nuts
13:56 -!- aho [~nya@fuld-4d00d2ef.pool.mediaWays.net] has quit [Ping timeout: 245
seconds]
13:56 < str1ngs> off hand you need to impliment anyone of the Json types to
the v interface
13:57 -!- Agon-laptop
[~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has quit [Remote
host closed the connection]
13:57 < sauerbraten> sr1ngs: the problem is, i don't know how to...
13:59 < chressie> sauerbraten: for example, if the json data is a dict (in
json { "blah": 123 }) you can use a map[string]int
14:01 -!- alehorst [~alehorst@189.114.190.166] has joined #go-nuts
14:01 < chressie> in general: afaik the unmarshal process tries to match the
json data to the provided data structure (e.g.  a map, slice, struct) and for
structs it tries to match the struct field names with the json data..
14:01 < sauerbraten> chressie: yes i know, (btw: in json that's called an
object, not dict...) but i'm not used to interfaces and only know that you an
write "type ABC interface { method1(bool) int; method2(int) string} and o on
14:02 < sauerbraten> ok let me try it out..
14:03 < sauerbraten> or wait...  can interfaces also include values, not
only methods?
14:03 < chressie> the empty interface is just a place holder, the
unmarshalling uses reflect to figure out what kind of object was provided
14:03 < sauerbraten> ahhh ok...  that makes sense
14:04 < str1ngs> in sort stuff anything that is json in there :P
14:04 < str1ngs> short*
14:09 -!- plainhao [~plainhao@mail.xbiotica.com] has joined #go-nuts
14:20 -!- dju_ [dju@fsf/member/dju] has quit [Read error: Connection reset by
peer]
14:21 < sauerbraten> :( could someone paste a code example that uses
json.Unmarshal() ? i don't get in working
14:21 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts
14:21 < bortzmeyer> sauerbraten: gotweet uses it, see their code
14:22 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Read
error: No route to host]
14:22 -!- Agon-laptop
[~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has joined
#go-nuts
14:23 < str1ngs> chressie: this new gist is working great.  os.Stat(p); err
== nil && g.IsDirectory() is what I was struggling to find
14:23 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined
#go-nuts
14:23 < str1ngs> and no recursion I might add.
14:27 < chressie> str1ngs: nice, i tested the code with only one test case
;)
14:27 -!- wrtp [~rog@92.17.4.40] has joined #go-nuts
14:27 < wrtp> mpl: ping
14:27 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has quit
[Quit: skelterjohn]
14:29 < str1ngs> chressie: I'm still wrapping my head around the need for
path.Split.  os.Readlink I get.
14:33 -!- tvw [~tv@212.79.9.150] has quit [Remote host closed the connection]
14:35 -!- visof [~visof@unaffiliated/visof] has quit [Quit: Leaving]
14:35 < str1ngs> ah path.Join uses Clean
14:35 < sauerbraten> may i make maps in wich the type of value differs?
e.g.  { "name":"john", "age":25 }
14:36 <+iant> sauerbraten: you can make map whose values are empty
interfaces; other than that, no
14:36 < mpl> wrtp: ah hello, thanks.  can you give me a few mins or are you
in a hurry?
14:37 < sauerbraten> iant: ok how do i create these?  map1 :=
make(map[string] interface{}) ?
14:37 <+iant> yes
14:37 < chressie> str1ngs: p still points to the name of the symbolic link.
split removes the symbolic link from path and join adds the result of Readlink to
the path
14:37 < str1ngs> chressie: which results in an absolute path.
14:38 < sauerbraten> iant: i get this error code when compiling with 8g:
json_test.go:24: invalid operation: ((node ADDSTR)) + v (type string + interface {
})
14:38 < chressie> str1ngs: it depends on the root parameter of Walk
14:39 <+iant> sauerbraten: I don't see that, what does line 24 look like
14:40 < sauerbraten> iant: omg sorry that's something totally different
>.< argh...  this error comes from: for i, v := range json_output {
14:40 < sauerbraten> print(i + " -> " + v)
14:40 < sauerbraten> } line 24 is te
14:40 < sauerbraten> line 24 is the print thing
14:40 <+iant> well, v is not a string
14:40 < sauerbraten> yes
14:41 < sauerbraten> i got that now, too :D
14:41 < str1ngs> chressie: yes that makes sense.  I was worried about use
the actuall link path but Clean takes care of it.
14:44 -!- ender2070 [~ender2070@bas22-toronto12-2925103372.dsl.bell.ca] has joined
#go-nuts
14:47 < chressie> alright good night, i'm off for today (CET) :)
14:48 -!- artefon [~thiago@dhcp46.usuarios.dcc.ufmg.br] has quit [Quit: bye]
14:49 -!- g0bl1n [~pr0kter@a213-22-76-1.cpe.netcabo.pt] has joined #go-nuts
14:50 < str1ngs> night thanks for the help chressie
14:51 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has joined
#go-nuts
14:54 -!- mxweas [~max@c-98-225-102-170.hsd1.az.comcast.net] has joined #go-nuts
14:55 -!- ikaros [~ikaros@drms-4d015b9e.pool.mediaWays.net] has quit [Quit: Leave
the magic to Houdini]
14:57 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
15:02 -!- wrtp [~rog@92.17.4.40] has quit [Ping timeout: 260 seconds]
15:02 -!- wrtp [~rog@92.17.8.68] has joined #go-nuts
15:02 -!- Agon-laptop
[~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has quit [Remote
host closed the connection]
15:06 -!- Agon-laptop
[~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has joined
#go-nuts
15:08 -!- visof [~visof@unaffiliated/visof] has joined #go-nuts
15:09 -!- awidegreen [~quassel@62.176.237.78] has joined #go-nuts
15:09 -!- Venom_X [~pjacobs@71.21.124.111] has joined #go-nuts
15:09 -!- Netsplit over, joins: cw
15:09 -!- Netsplit *.net <-> *.split quits: jnwhiteh, SecretAgent, impl,
roto, MadMethod
15:09 -!- Netsplit over, joins: SecretAgent
15:09 -!- impl [impl@224-74.ip4.durham0.network.cynigram.com] has joined #go-nuts
15:09 -!- impl [impl@224-74.ip4.durham0.network.cynigram.com] has quit [Changing
host]
15:09 -!- impl [impl@atheme/member/impl] has joined #go-nuts
15:10 -!- Method [~Method@unaffiliated/method] has joined #go-nuts
15:10 -!- Netsplit over, joins: jnwhiteh
15:23 -!- roto [~roto@64.79.202.154] has joined #go-nuts
15:24 -!- skelterjohn [~jasmuth@c-76-116-181-134.hsd1.nj.comcast.net] has quit
[Quit: skelterjohn]
15:29 -!- ayo [~nya@fuld-4d00d7fb.pool.mediaWays.net] has joined #go-nuts
15:32 -!- ako [~nya@fuld-4d00d38e.pool.mediaWays.net] has quit [Ping timeout: 240
seconds]
15:33 -!- iant [~iant@62.20.124.50] has quit [Ping timeout: 248 seconds]
15:36 -!- ukai [~ukai@220.109.219.244] has quit [Ping timeout: 265 seconds]
15:38 -!- gid1 [~gid@220.253-225-62.VIC.netspace.net.au] has joined #go-nuts
15:38 < sauerbraten> is this valid code: make([]map[string]interface{}) to
create a slice of maps?
15:38 < jessta> sauerbraten: it will create the slice, but not the maps
15:39 < exch> you'll have to loop through each element of the slice and
create the map manually
15:40 < sauerbraten> i have a json file, consisting of an array of json
objects...  json arrays get unmarshalled to slices and objects to maps
15:40 < sauerbraten> exch: what if i don't know how long the slice is?
15:40 < exch> len(myslice) ?
15:41 < sauerbraten> mhm ok there would be a possibility....  no other
better way to do that?
15:41 < exch> Not as far as I know.
15:41 < sauerbraten> exch: i first create the slice, then fill it so i don't
know how long
15:41 < jessta> sauerbraten: you also need to specify the size of the slice
you're making
15:41 < sauerbraten> jessta: argh
15:41 < exch> sauerbraten: you have to know how long it is when you create
it
15:42 < sauerbraten> ok then i think i know how i'll do it
15:42 < exch> just creating an empty slice with no length parameter is a
slice of size 0
15:42 < jessta> eg.  make([]map[string]interface{},10)
15:42 < jessta> sauerbraten: if you don't know the size then use a vector
15:42 < sauerbraten> what is a vector?
15:42 < jessta> import container/vector
15:43 < exch> it allows dynamic resizing.  It resizes itself as you insert
new items
15:43 < exch> basically a slice that does the resizing for you internally
15:44 -!- carllerche [~carllerch@208.87.61.203] has joined #go-nuts
15:44 -!- bortzmeyer [~bortzmeye@batilda.nic.fr] has quit [Quit: Leaving.]
15:44 < sauerbraten> that's nice, but json.Unmarshal() needs a slice to put
output in
15:45 < sauerbraten> but i now know how i can make it work
15:45 < exch> pass it an empty slice
15:45 < exch> it will do the resizing as it filles it for you
15:46 < exch> when it's done, the slice will contain as many items as their
are json data elements
15:47 -!- ayo [~nya@fuld-4d00d7fb.pool.mediaWays.net] has quit [Quit:
EXEC_over.METHOD_SUBLIMATION]
15:51 < sauerbraten> exch: wait...  if i do "make([]map[string]interface{})"
it creates a slice of maps, and Unmarshal creates the maps itself?  or do i have
to create them manually before?
15:52 < exch> Now there's a surprising turn of events:
http://www.nzcs.org.nz/news/blog.php?/archives/97-.html
15:53 < exch> sauerbraten: you don't even have to do the make() bit if all
you do is pass it to json.Unmarshal().  Just do: var myslice
[]map[string]interface{}; json.Unmarshal(data, &myslice);
15:53 < exch> Unmarshal() will take care of all the
initialization/resizing/filling, etc
15:53 < sauerbraten> exch: oh that's even cooler :D
15:53 < sauerbraten> exch: thanks a lot
15:53 < exch> np
16:10 -!- carllerche [~carllerch@208.87.61.203] has quit [Quit: carllerche]
16:21 -!- gid [~gid@220.253-225-62.VIC.netspace.net.au] has quit [Disconnected by
services]
16:22 -!- gid1 [~gid@220.253-225-62.VIC.netspace.net.au] has joined #go-nuts
16:29 -!- Fish [~Fish@9fans.fr] has joined #go-nuts
16:29 < sauerbraten> how do i convert string to int?
16:30 < MaybeSo> strconv.Atoi()
16:31 < sauerbraten> thanks
16:31 < wrtp> fmt.Scan(&i) :-)
16:33 < sauerbraten> wrtp: what does that do?  convert string to int??
16:34 < wrtp> sauerbraten: yes, if i is an int
16:34 < sauerbraten> woha...
16:34 < sauerbraten> nice hack :D
16:34 < Ginto8> wrtp, fmt.Sscan
16:35 < Ginto8> not fmt.Scan
16:35 < wrtp> oops
16:35 < wrtp> yes
16:35 < MaybeSo> sauerbraten: it's like scanf
16:35 < Ginto8> unless it's just from stdin
16:35 < MaybeSo> (in C)
16:35 < sauerbraten> i read the doc about Scan and thought WTF?
16:35 < sauerbraten> :D
16:35 < wrtp> it's probably slower than strconv.Atoi, but you probably won't
notice
16:35 < Ginto8> ^ yeah
16:35 < sauerbraten> i think strconv.Atoi is cleaner, right?
16:36 < Ginto8> probably
16:36 < MaybeSo> I'd think using strconv would be clearer to future readers
of the code
16:36 < Ginto8> because it returns the ing
16:36 < Ginto8> int*
16:36 < sauerbraten> yeah
16:38 < wrtp> true (which is why i put in the smiley) but Sscan is nicely
general - you don't have to remember a different function name for each type that
you want to convert...
16:39 < sauerbraten> why does "for range v {" not work, as well as "for _, _
:= range v {" ?
16:39 < sauerbraten> while v is a map
16:39 < Ginto8> why would you want that?
16:39 < Ginto8> what's the point?
16:39 < Ginto8> for i:=0;i<len(v);i++ {}
16:39 < sauerbraten> because i don't need key and value
16:39 < MaybeSo> sauerbraten: do you want: for key, val := range v { } ?
16:40 < Ginto8> sauerbraten, why not?
16:40 < MaybeSo> sorry, what were you trying to do?
16:40 < sauerbraten> Ginto8: i just don't need them, because i know what the
keys are and access them with v["Name"]
16:40 < MaybeSo> it's kind of silly to use _, _ in a range, but if you
wanted to I suspect this would work: for _, _ = range v { } ( so =, not :=)
16:40 < sauerbraten> but Ginto8's solution looks good
16:41 < sauerbraten> MaybeSo: right...  i'll use the range thing
16:41 < sauerbraten> thanks anyway Ginto8
16:43 -!- carllerche [~carllerch@208.87.61.203] has joined #go-nuts
16:43 -!- g0bl1n [~pr0kter@a213-22-76-1.cpe.netcabo.pt] has quit [Ping timeout:
240 seconds]
16:51 < plexdev> http://is.gd/dtalL by [Russ Cox] in go/src/ -- cgo: use new
command line syntax: -- separates cgo flags from gcc flags
16:57 < sauerbraten> i use http.Get to request a webpage...  but since the
url i request does not return a HTML file it fails with: malformed HTTP status
code "HTML"
16:57 < sauerbraten> how to fix that?
16:59 -!- MadMethod [~Method@unaffiliated/method] has joined #go-nuts
17:00 < wrtp> it should work fine on non-HTML files
17:01 < sauerbraten> i'll paste the code i use...  one second
17:01 < wrtp> looks like maybe the server is broken - it doesn't seem to be
returning a correct HTML status
17:01 < wrtp> what's the URL?
17:03 -!- Method [~Method@unaffiliated/method] has quit [Ping timeout: 265
seconds]
17:03 < sauerbraten> for example:
http://tinysong.com/b/a.b-c_d+e?format=json&limit=0
17:03 < sauerbraten> the one my prog fails at is:
http://tinysong.com/s/bob+airplanes
17:03 < sauerbraten> ?format=json&limit=3
17:04 < sauerbraten> oops without newline of course..
http://tinysong.com/s/bob+airplanes?format=json&limit=3
17:05 -!- Ginto8 [~ginto8@pool-72-82-235-34.cmdnnj.fios.verizon.net] has quit
[Ping timeout: 240 seconds]
17:06 -!- dju_ [dju@fsf/member/dju] has quit [Read error: Connection reset by
peer]
17:07 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts
17:07 < Linnk> Hey, just started learning Go. I'm looking for a better way
to write the recursive definition of Fibonacci with the "big" module.  Right now
I've got this working, but it's not very pretty...  http://pastebin.com/yQVz0tZL
17:10 < MaybeSo> Linnk: awhile ago this thread was posted on golang-nuts:
http://groups.google.com/group/golang-nuts/browse_thread/thread/dd9a661a638fb27d
17:13 < Linnk> MaybeSo: That doesn't use "big" or recursivity, but I'm sure
it's a nice example of channels and stuff :)
17:13 < MaybeSo> yes, that was why I was pointing it out
17:13 < MaybeSo> I tried a little bit of highly recursive code in go awhile
ago and was not impressed with its speed
17:13 < MaybeSo> it is, however, very good at message passing.
17:14 < Linnk> I'm not really concerned with speed atm, I'm just trying to
write a prettier recursive Fibonacci with the big module
17:14 < MaybeSo> *nod*
17:15 -!- visof [~visof@unaffiliated/visof] has quit [Quit: Leaving]
17:15 < Linnk> I'm aware it sounds crazy, but my problem is mainly with the
big api, which seems to make even simple things very difficult - unless there's
something I don't know :)
17:18 < temoto> Linnk, "big api" sounds like it's not supposed to be simple
:)
17:18 < jessta> if you're using 'big' then you're unlikely to be doing
something simple
17:18 < MaybeSo> I've not used it, but using similar things in Java I
usually found those packages tend to add a lot of clutter
17:18 -!- bortzmeyer [~stephane@2a01:e35:8bd9:8bb0:60d5:e557:ddd2:f3f4] has joined
#go-nuts
17:24 -!- dju_ [dju@fsf/member/dju] has quit [Ping timeout: 276 seconds]
17:25 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts
17:27 -!- Agon-laptop
[~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has quit [Remote
host closed the connection]
17:28 < MaybeSo> Perhaps declaring some repeated variables can help reduce
clutter: http://pastebin.com/EdjSKu68
17:30 -!- Ginto8 [~ginto8@pool-72-82-235-34.cmdnnj.fios.verizon.net] has joined
#go-nuts
17:31 -!- gregorstocks [~gregors@nat/google/x-vnpgzbacxmmtfdab] has quit []
17:32 -!- dju__ [dju@fsf/member/dju] has joined #go-nuts
17:32 -!- dju_ [dju@fsf/member/dju] has quit [Ping timeout: 252 seconds]
17:33 -!- crashR [~crasher@codextreme.pck.nerim.net] has quit [Ping timeout: 264
seconds]
17:34 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
17:34 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts
17:34 -!- dju__ [dju@fsf/member/dju] has quit [Read error: Connection reset by
peer]
17:41 -!- path[l] [~path@59.162.86.164] has quit [Quit: path[l]]
17:45 < sauerbraten> how to delete whitespace like \t or \n from strings?
17:45 < Ginto8> well if it's at the end
17:45 < Ginto8> str = str[0:len(str)-1]
17:45 < wrtp> strings.TrimRight() i think
17:46 < sauerbraten> wrtp: you are right, thanks
17:48 < wrtp> if you want to delete all whitespace you could do.
strings.Map(func(c int) int {if c == '\t' || c == '\n' {return c}; return -1}, s)
17:48 < wrtp> oops that's the wrong way around!@
17:48 < sauerbraten> wrtp: strings.TrimWhite() is even better :D
17:48 < sauerbraten> *TrimSpace()
17:48 < wrtp> strings.Map(func(c int) int {if c == '\t' || c == '\n' {return
-1}; return c}, s)
17:48 < ampleyfly> fields might be helpful
17:48 < ampleyfly> and join
17:49 < wrtp> in general: read through the strings package :-)
17:49 < sauerbraten> wrtp: i just am :D
17:54 -!- skelterjohn [~jasmuth@lawn-net168-in.rutgers.edu] has joined #go-nuts
18:01 < Linnk> temoto & jessta: Calculating the Fibonacci sequence is pretty
simple, but yeah, I get your point :)
18:02 < Linnk> MaybeSo: Thought about that too, it kinda helps, I guess it
won't get any prettier than that
18:02 -!- path[l] [~path@122.182.0.38] has joined #go-nuts
18:02 < sauerbraten> silly question, but how do i execute go programs on
windows?  the compiled and linked machine code?  do i have to have go installed?
18:05 < KirkMcDonald> sauerbraten: You should have an .exe, I would think.
18:05 < KirkMcDonald> And it shouldn't have any particular dependencies.
18:06 < sauerbraten> KirkMcDonald: where do i get that .exe from?  :D
18:06 < KirkMcDonald> sauerbraten: The linker.
18:06 < sauerbraten> KirkMcDonald: and how?  :/
18:06 < KirkMcDonald> Just like on Linux, I would think.
18:06 < KirkMcDonald> I have not used Go on Windows.
18:07 -!- path[l] [~path@122.182.0.38] has quit [Ping timeout: 245 seconds]
18:07 < KirkMcDonald> Except where Linux gives a binary without an
extension, you'd want a binary with .exe on Windows.
18:08 < KirkMcDonald> And, of course, the binary is an ELF binary on Linux,
and a PE on Windows.
18:09 < KirkMcDonald> So hopefully the linker knows that.
18:09 -!- Project_2501 [~Marvin@82.84.92.36] has joined #go-nuts
18:09 < Linnk> MaybeSo: Hmm, did you try running the code on the pastebin?
It seems to give the wrong results
18:10 -!- rutkowski [~adrian@078088207115.walbrzych.vectranet.pl] has joined
#go-nuts
18:10 < MaybeSo> I certainly might have made a mistake, I ran yours and mine
w/ the input value and got the same output value and didn't really check beyond
that
18:13 < sauerbraten> KirkMcDonald: it seems not to be possible to compile Go
code for windows :(
18:13 < KirkMcDonald> Really?  I thought someone was working on that.
18:17 < MaybeSo> sauerbraten: I know it's possible for me to compile a Linux
executable on my Mac OS X box (once I've built and copied over the approporaite
$GOROOT/pkg/$os_$hardware/ directory to my mac)
18:18 < MaybeSo> there's a thread from just two weeks ago which make it
sounds as though the windows support is a work in progress:
http://groups.google.com/group/golang-nuts/browse_thread/thread/bad332db9df4194a/dab939bd6f77127f?lnk=gst&q=windows#dab939bd6f77127f
18:23 -!- path[l] [UPP@120.138.102.50] has joined #go-nuts
18:29 -!- tgall_foo [~tgall@gentoo/developer/dr-who] has quit [Ping timeout: 240
seconds]
18:33 -!- tvw [~tv@e176001143.adsl.alicedsl.de] has joined #go-nuts
18:37 -!- snearch [~snearch@f053002225.adsl.alicedsl.de] has joined #go-nuts
18:39 < Ginto8> KirkMcDonald, the mingw port is incomplete
18:40 < Ginto8> I think they still have a bit of syscall and os to port
18:40 < KirkMcDonald> Ginto8: But the linker knows how to make PE binaries?
18:40 < Ginto8> I think so
18:40 < Ginto8> I'm not sure, haven't followed it much
18:41 < Ginto8> there's a page on the go wiki linked to on the main golang
web site
18:51 -!- bmizerany [~bmizerany@dsl081-064-072.sfo1.dsl.speakeasy.net] has joined
#go-nuts
18:52 -!- napsy [~luka@212.235.174.112] has joined #go-nuts
18:57 -!- Eridius [~kevin@unaffiliated/eridius] has joined #go-nuts
19:06 -!- snearch [~snearch@f053002225.adsl.alicedsl.de] has quit [Quit:
Verlassend]
19:11 -!- plainhao [~plainhao@mail.xbiotica.com] has quit [Quit: plainhao]
19:17 -!- tgall_foo [~tgall@gentoo/developer/dr-who] has joined #go-nuts
19:19 -!- ender2070 [~ender2070@bas22-toronto12-2925103372.dsl.bell.ca] has quit
[Remote host closed the connection]
19:25 -!- ShadowIce` [pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
19:28 -!- rv2733 [~rv2733@c-98-242-168-49.hsd1.fl.comcast.net] has joined #go-nuts
19:29 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has quit [Ping timeout:
240 seconds]
19:33 -!- Paradox924X [~Paradox92@vaserv/irc/founder] has quit [Ping timeout: 240
seconds]
19:34 -!- rlab [~Miranda@91.200.158.34] has quit [Read error: Connection reset by
peer]
19:36 -!- bmizerany [~bmizerany@dsl081-064-072.sfo1.dsl.speakeasy.net] has quit
[Read error: Operation timed out]
19:37 -!- Paradox924X [~Paradox92@178.119.188.72.cfl.res.rr.com] has joined
#go-nuts
19:39 -!- bmizerany [~bmizerany@dsl081-064-072.sfo1.dsl.speakeasy.net] has joined
#go-nuts
19:39 < plexdev> http://is.gd/dtldM by [Ian Lance Taylor] in
go/src/pkg/runtime/ -- Clarify that a new goroutine is not started for each
finalizer.
19:42 -!- tgall_foo [~tgall@gentoo/developer/dr-who] has quit [Quit: Leaving]
19:43 -!- tgall_foo [~tgall@gentoo/developer/dr-who] has joined #go-nuts
19:44 -!- tgall_foo [~tgall@gentoo/developer/dr-who] has quit [Remote host closed
the connection]
19:44 -!- Dr_Who [~tgall@gentoo/developer/dr-who] has joined #go-nuts
19:46 -!- jchico [~jchico@cpe-98-14-12-209.nyc.res.rr.com] has joined #go-nuts
20:03 -!- rinzai [~rinzai@81.129.148.230] has joined #go-nuts
20:03 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Quit:
hcatlin]
20:07 -!- gid [~gid@220.253-225-62.VIC.netspace.net.au] has quit [Quit: Leaving.]
20:08 -!- MizardX [~MizardX@unaffiliated/mizardx] has quit [Quit: reboot]
20:08 < sauerbraten> if i want to be able to execute my program like "myprog
action param1 param2" should i use flags and just get all non flags?
20:09 < skelterjohn> does it always have exactly three arguments, in that
order?
20:10 < skelterjohn> if so, just inspect os.Args
20:10 < skelterjohn> otherwise using flags or
http://code.google.com/p/optparse-go
20:11 < sauerbraten> skelterjohn: it always has one action and then one or
two parameters
20:11 -!- sioraiocht [~tomh@unaffiliated/sioraiocht] has joined #go-nuts
20:11 < sauerbraten> i found a good source of info, gotwet uses the same
style
20:11 < skelterjohn> then it will probably be easiest to use os.Args
20:11 < sauerbraten> *gotweet
20:12 < sauerbraten> ok i'll have a look at os.Args
20:12 < skelterjohn> it's just a slice of the command line arguments
20:16 -!- Dr_Who [~tgall@gentoo/developer/dr-who] has quit [Quit: Leaving]
20:16 -!- tgall_foo [~tgall@gentoo/developer/dr-who] has joined #go-nuts
20:16 -!- MizardX [~MizardX@unaffiliated/mizardx] has joined #go-nuts
20:18 < vrtical> sauerbraten: don't feel bad, I had no idea os.Args existed
either until someone here told me.  *every* example program that uses arguments
seems to use flag :-)
20:20 < sauerbraten> vrtical: puh feels good not to be the only one that
doesn't know such things :D
20:21 < sauerbraten> skelterjohn: may i use os.Args[0] to get the first
argument or os.Args[0:1]?
20:21 < skelterjohn> er?
20:21 < skelterjohn> os.Args is a []string
20:21 < skelterjohn> os.Args[0:1] would be a string slice with length one
20:22 < skelterjohn> i just experimenting with example programs
20:22 < sauerbraten> oh..  so how do i access the args?
20:23 < sauerbraten> i still seem to be focussed on Java arrays :/
20:23 < skelterjohn> os.Args[0] is the first element in the argument list
20:23 < skelterjohn> os.Args[1] is the second, etc
20:23 -!- rutkowski [~adrian@078088207115.walbrzych.vectranet.pl] has quit [Quit:
WeeChat 0.3.3-dev]
20:23 < sauerbraten> ok so just like i did it?
20:23 < skelterjohn> i have no idea how you did it
20:23 < skelterjohn> so, possibly :)
20:23 < Ginto8> and os.Args[0] will always be the filepath of the executable
20:24 < skelterjohn> that was the part i didn't know if was the case or not
20:24 < skelterjohn> since it varies from language to language
20:24 < sauerbraten> i did it like you so it should be right :D how may i
check that there are enough args given and if not print out a help?
20:24 < skelterjohn> not necessarily the filepath, but how the executable
was invoked
20:24 < Ginto8> no, if it uses Args or Argv
20:24 < Ginto8> then [0] is the executable
20:24 < Ginto8> you can test it if you like
20:24 < Ginto8> well yeah
20:26 < sauerbraten> so os.Args[1] is my first arg?
20:27 < skelterjohn> yes
20:28 < sauerbraten> i think i'm gonna use flags though, it has most stuff
implemented...  also the usage/help print
20:29 < skelterjohn> using a forklift to carry a suitcase, etc
20:30 < Ginto8> well if you want flags use flags
20:30 < Ginto8> if you just want args use os.Args
20:32 < Ginto8> ok just tested it
20:32 < Ginto8> os.Args[0] is the invoking command
20:32 < Ginto8> other args are just space-delimited strings
20:36 < vrtical> and it's a slice of strings (i.e.  like an array of
strings) so you can find out how big it is with len as usual.
20:44 -!- getisboy [~Family@c-24-128-240-75.hsd1.ma.comcast.net] has joined
#go-nuts
20:50 < sauerbraten> Ginto8: how do you do help printout with os.Args?
20:53 < cw> godoc flag
20:54 < skelterjohn> fmt.Println("Here is a message that tells people how to
use this program.")
20:54 < cw> func PrintDefaults()
20:54 < sauerbraten> cw: thanks but that's exactly what i am doing...
20:54 < cw> PrintDefaults prints to standard error the default values of all
defined flags.
20:54 < cw> is that what you mean?
20:54 < skelterjohn> he's asking for if he uses os.Args directly.  rather
than the flags package.
20:55 < sauerbraten> no cw, atm I USE flag, and it's called flag.Usage there
;)
20:56 < cw> Ginto8: args aren't space delimited
20:56 < Ginto8> cw, they aren't?
20:56 < skelterjohn> uh
20:56 < cw> form a shell input PoV they are
20:56 < cw> but there is no API requirement they be like that
20:56 < Ginto8> oh ok
20:56 < Ginto8> that makes sens
20:56 < Ginto8> sense*
20:56 < Ginto8> I was just thinking from shell input
20:57 < cw> yes, spaces are painful these days
20:57 < skelterjohn> so, they aren't space delimited, except that they will
always happen to be space delimited?
20:57 < cw> a few things i've written in got have -z for for a 0 delimiter
20:57 < skelterjohn> interesting
20:57 < cw> so i can use xargs -r0
20:57 < cw> path/to/foo "arg1" "arg2" "arg3"
20:58 < cw> will have four strings none of which contain spaces anywhere,
they are null terminated because the OS requires that
20:58 < cw> man 2 execve
20:59 < cw> anyone here seeing memory leaks with TIP?
20:59 < vrtical> possibly you can mess around with shell quoting to make
some arguments with spaces in?
21:00 < cw> path/to/foo " this args has spaces "
21:05 -!- cyclades [seal45@139.78.231.66] has joined #go-nuts
21:10 -!- carllerche [~carllerch@208.87.61.203] has quit [Quit: carllerche]
21:11 -!- getisboy [~Family@c-24-128-240-75.hsd1.ma.comcast.net] has left #go-nuts
[]
21:11 -!- mat_ [~mat@mx3.absolight.net] has quit [Remote host closed the
connection]
21:11 -!- mat_ [~mat@mx3.absolight.net] has joined #go-nuts
21:18 -!- path[l] [UPP@120.138.102.50] has quit [Quit: path[l]]
21:20 -!- jA_cOp [~yakobu@unaffiliated/ja-cop/x-9478493] has joined #go-nuts
21:20 -!- TR2N [email@89-180-146-175.net.novis.pt] has joined #go-nuts
21:20 -!- mbarkhau [~koloss@dslb-088-068-251-010.pools.arcor-ip.net] has quit
[Quit: Leaving.]
21:21 -!- jchico [~jchico@cpe-98-14-12-209.nyc.res.rr.com] has quit [Quit:
Leaving]
21:22 -!- rv2733 [~rv2733@c-98-242-168-49.hsd1.fl.comcast.net] has quit [Quit:
Leaving]
21:22 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
joined #go-nuts
21:25 -!- bortzmeyer [~stephane@2a01:e35:8bd9:8bb0:60d5:e557:ddd2:f3f4] has quit
[Quit: Leaving.]
21:26 < plexdev> http://is.gd/dtrJ4 by [Ian Lance Taylor] in 2 subdirs of
go/src/ -- Build libcgo.so with $(CC), not the gcc on PATH.
21:26 < plexdev> http://is.gd/dtrJ7 by [Russ Cox] in 4 subdirs of go/ -- gc:
fix handling of types inside function bodies
21:27 -!- napsy [~luka@212.235.174.112] has quit [Ping timeout: 245 seconds]
21:27 < sauerbraten> i have a file gots.go and one main.go and in main.go i
import "./gots.go", but if i do gots.Search() it says it's undefined, though i
define them in gots.go...  why?
21:28 < cw> is gots.go using the package name gots?
21:28 < cw> oh, import ...  .go
21:28 < cw> isn't what you should be doing
21:29 < cw> import "./gots" should be fine
21:29 < cw> and make sure gots.[68] exists
21:29 -!- Project_2501 [~Marvin@82.84.92.36] has quit [Quit: E se abbasso questa
leva che succ...]
21:29 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
quit [Quit: Bye]
21:30 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
joined #go-nuts
21:30 < KirkMcDonald> sauerbraten: You don't import .go files, you import
compiled packages.
21:32 < sauerbraten> KirkMcDonald: i can compile gots.go, but not link it,
it says it is not package main (package gots) and main.main and main.init aren't
defined
21:35 < sauerbraten> ahh nvm..  got it work
21:36 -!- bechmoul [~joel@lolnet.org] has left #go-nuts []
21:40 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
quit [Quit: Bye]
21:40 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
joined #go-nuts
21:41 -!- sauerbraten [~sauerbrat@p508CFA36.dip.t-dialin.net] has quit [Remote
host closed the connection]
21:42 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
quit [Client Quit]
21:43 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
joined #go-nuts
21:43 < vrtical> sauerbraten: the package names are distinct from the file
names.  You could have a.go, b.go and c.go all making up the package foo (each of
them would start with the line 'package foo') and anything that used them would
just have to import foo
21:44 -!- matt2909 [~matt2909@host81-157-56-185.range81-157.btcentralplus.com] has
quit [Client Quit]
21:50 -!- Fish [~Fish@9fans.fr] has quit [Read error: Connection reset by peer]
21:58 -!- welterde [~welterde@not.welterde.de] has quit [Read error: Operation
timed out]
21:58 -!- NfNitLoop [~bip@2001:470:b9cc:beef::1] has quit [Read error: Operation
timed out]
21:59 -!- kw- [~aevirex@d86-32-213-87.cust.tele2.at] has quit [Ping timeout: 276
seconds]
22:01 -!- ShadowIce` [pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
22:01 -!- yashi [~yashi@dns1.atmark-techno.com] has quit [Ping timeout: 276
seconds]
22:01 -!- NfNitLoop [~bip@2001:470:b9cc:beef::1] has joined #go-nuts
22:02 -!- MattCampbell [~matt@ip68-102-47-79.ks.ok.cox.net] has joined #go-nuts
22:02 < MattCampbell> Does Go have a C FFI?
22:03 < KirkMcDonald> MattCampbell: http://golang.org/cmd/cgo/
22:05 < MattCampbell> Are there any plans to write a Go GUI toolkit, or Go
bindings for an existing toolkit?  I imagine that's outside Go's niche.
22:06 -!- skelterjohn [~jasmuth@lawn-net168-in.rutgers.edu] has quit [Quit:
skelterjohn]
22:06 < KirkMcDonald> cgo does not yet support callbacks.
22:06 < KirkMcDonald> Which complicates binding to most GUI APIs.
22:10 -!- skelterjohn [~jasmuth@lawn-net168-in.rutgers.edu] has joined #go-nuts
22:13 < plexdev> http://is.gd/dtuE4 by [Russ Cox] in 3 subdirs of go/ -- gc:
bug274
22:14 -!- welterde [~welterde@2001:470:1f0b:592:10:1:1:0] has joined #go-nuts
22:15 -!- cyclades [seal45@139.78.231.66] has quit [Ping timeout: 245 seconds]
22:19 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined
#go-nuts
22:21 < skelterjohn> MattCampbell: there is recent discussion about that on
the ML - the thread about a go IDE
22:21 -!- rinzai [~rinzai@81.129.148.230] has quit [Quit: Leaving]
22:23 -!- skelterjohn [~jasmuth@lawn-net168-in.rutgers.edu] has quit [Quit:
skelterjohn]
22:24 -!- napsy [~luka@212.235.174.112] has joined #go-nuts
22:28 -!- mxweas [~max@c-98-225-102-170.hsd1.az.comcast.net] has quit [Quit: Mac
has gone to sleep]
22:29 < MaybeSo> anyone known when http://golang.org/doc/codewalk/sharemem/
first appeared ?
22:30 < plexdev> http://is.gd/dtvux by [Russ Cox] in 3 subdirs of go/ -- gc:
bug291
22:30 < plexdev> http://is.gd/dtvuy by [Russ Cox] in go/src/cmd/gc/ -- gc:
issue 901
22:30 < plexdev> http://is.gd/dtvuG by [Russ Cox] in 3 subdirs of
go/src/cmd/ -- gc: issue 894
22:30 < MaybeSo> oh, I guess I can check the revision control if it's
there...
22:30 -!- skelterjohn [~jasmuth@nat02-nbpwireless-ext.rutgers.edu] has joined
#go-nuts
22:32 < MaybeSo> ha!  Andrew Gerrand expanded the example he sent me in
usenet.
22:32 -!- awidegreen [~quassel@62.176.237.78] has quit [Remote host closed the
connection]
22:38 -!- kanru [~kanru@118-160-163-155.dynamic.hinet.net] has joined #go-nuts
22:40 -!- skelterjohn [~jasmuth@nat02-nbpwireless-ext.rutgers.edu] has quit [Quit:
skelterjohn]
22:49 -!- Venom_X [~pjacobs@71.21.124.111] has quit [Ping timeout: 240 seconds]
22:50 -!- alehorst [~alehorst@189.114.190.166] has quit [Quit: Leaving.]
22:54 -!- General13372 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has joined
#go-nuts
22:56 -!- mxweas [~max@c-98-225-102-170.hsd1.az.comcast.net] has joined #go-nuts
22:58 -!- General1337 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has quit
[Ping timeout: 246 seconds]
23:00 -!- ExtraSpice [~ExtraSpic@88.118.32.225] has quit [Ping timeout: 240
seconds]
23:07 -!- Linnk [~Linnk@ip-56-115.bnaa.dk] has quit [Remote host closed the
connection]
23:16 < plexdev> http://is.gd/dtxRe by [Robert Griesemer] in 2 subdirs of
go/src/pkg/ -- bignum: delete package - functionality subsumed by package big
23:16 < plexdev> http://is.gd/dtxRf by [Russ Cox] in 2 subdirs of go/ -- gc:
bug292
23:17 < plexdev> http://is.gd/dtxRs by [Russ Cox] in 5 subdirs of go/ -- gc:
bug293
23:18 -!- Shyde [~Shyde^^@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de]
has quit [Remote host closed the connection]
23:19 -!- lmoura_ [~lmoura@187.78.165.78] has joined #go-nuts
23:20 -!- sioraiocht [~tomh@unaffiliated/sioraiocht] has quit [Remote host closed
the connection]
23:24 -!- mxweas [~max@c-98-225-102-170.hsd1.az.comcast.net] has quit [Quit: Mac
has gone to sleep]
23:26 -!- sioraiocht [~tomh@unaffiliated/sioraiocht] has joined #go-nuts
23:30 -!- ender2070 [~ender2070@bas22-toronto12-2925103372.dsl.bell.ca] has joined
#go-nuts
23:35 -!- mxweas [~max@c-98-225-102-170.hsd1.az.comcast.net] has joined #go-nuts
23:35 -!- sioraiocht [~tomh@unaffiliated/sioraiocht] has quit [Remote host closed
the connection]
23:37 -!- tvw [~tv@e176001143.adsl.alicedsl.de] has quit [Remote host closed the
connection]
23:42 -!- Paradox924X [~Paradox92@178.119.188.72.cfl.res.rr.com] has quit
[Changing host]
23:42 -!- Paradox924X [~Paradox92@vaserv/irc/founder] has joined #go-nuts
23:45 -!- carllerche [~carllerch@208.87.61.203] has joined #go-nuts
23:49 < plexdev> http://is.gd/dtzqI by [Russ Cox] in 2 subdirs of go/ -- gc:
bug294
23:49 < plexdev> http://is.gd/dtzqN by [Russ Cox] in go/lib/codereview/ --
codereview: don't run gofmt with an empty file list
23:50 -!- napsy [~luka@212.235.174.112] has quit [Ping timeout: 240 seconds]
23:56 -!- yashi [~yashi@dns1.atmark-techno.com] has joined #go-nuts
23:59 -!- emmanueloga [~emmanuelo@190.247.41.202] has joined #go-nuts
--- Log closed Fri Jul 16 00:00:12 2010