Live data from Hacker News

Gonix – Unix tools written in Go

github.com

31–40 of 85 posts

Re: Gonix – Unix tools written in Go

#31

Earlier quoted context omitted.

Thank you. I will look into this.

No problem. Also, please do not ignore errors. They're meant to be handled.

I'm working on that as well. I just fixed cat to crash and log on error, and I'll be fixing the other commands soon.

By the way, I'm wondering how I should go through the file line by line with a reader.

I think the most efficient way may be to scan byte by byte from the start (head) or the end (tail), and count until reaching n amount of newlines (or stop if at the end of the file), then print the bytes between the start/end and the nth newline.

How does this sound?

Re: Gonix – Unix tools written in Go

#32
post #13

Forget the haters, this is awesome. GNU started as GNU's Not Unix, reimplementing Unix userland for free. The people who are adamant about calling it GNU/Linux are, on some level, remembering that the userspace is historically a reimplementation. Give me a busybox that I can 'go build' and that becomes really quite interesting.

Except for the fact that it'll be years before all of the subtle bugs are worked out and you can rely on those apps to be as stable as the ones we've got: http://www.joelonsoftware.com/articles/fog0000000069.html

We have years. They're passing whether we like it or not. In the meantime you can choose whichever implementation of the Unix tools that you want. In the future there may be more options that fit the bill, developed in a safe language without the kinds of buffer overflows and things that exist in C tools today.

Re: Gonix – Unix tools written in Go

#33
post #18

Not meaning to bring up a Rust vs Go debate, but since there are a few comments claiming that this is a waste of time, I figured it's worth mentioning the Rust based re-implementation of coreutils: https://github.com/uutils/coreutils/ And another by suckless in plain C: http://git.suckless.org/sbase/tree/README

Or my rewrite of GNU's coreutils in Go: https://github.com/EricLagerg/go-coreutils

It's not complete yet, but I couldn't pass up this thread :-)

Re: Gonix – Unix tools written in Go

#34

Earlier quoted context omitted.

No problem. Also, please do not ignore errors. They're meant to be handled.

I'm working on that as well. I just fixed cat to crash and log on error, and I'll be fixing the other commands soon. By the way, I'm wondering how I should go through the file line by line with a reader. I think the most efficient way may be to scan byte by byte from the start (head) or the end (tail), and count until reaching n amount of newlines (or stop if at the end of the file), then print the bytes between the…

Good question. I'm not sure. You might want to seek to the end and move back. You probably shouldn't do it byte-by-byte directly from the file since that's very inefficient. As you can tell, this is already starting to get complicated! Maybe you could try mmaping the file so you could treat it as a []byte.

Re: Gonix – Unix tools written in Go

#35

Heh, this brings me back. I was a young guy at Sun, perl 4 was a thing, I actually argued that we should redo /usr/bin in perl. In the days of a 20mhz SPARC. Silly me. Maybe it makes sense now.

There's "Perl Power Tools: Unix Reconstruction Project" [0], which doesn't seem to have activity since 2004. I remember something older than 2004, I think, back from when perl was first available on Windows, to bring UNIX command line utilities to Windows through perl.

It's great that they all have inline POD documentation too.

[0] http://search.cpan.org/dist/ppt/

Re: Gonix – Unix tools written in Go

#37
post #11

https://github.com/polegone/gonix/search?utf8=%E2%9C%93&q=re... Goodbye, memory.

I don't know much about go, but taking a quick look at implementations - they seem to be written by a programming novice, and the are quite primitive. Don't mean to be negative, just my opinion.

Re: Gonix – Unix tools written in Go

#38
post #18

Not meaning to bring up a Rust vs Go debate, but since there are a few comments claiming that this is a waste of time, I figured it's worth mentioning the Rust based re-implementation of coreutils: https://github.com/uutils/coreutils/ And another by suckless in plain C: http://git.suckless.org/sbase/tree/README

Or my rewrite of GNU's coreutils in Go: https://github.com/EricLagerg/go-coreutils It's not complete yet, but I couldn't pass up this thread :-)

I must say that yours is much more complete than mine, though.

Re: Gonix – Unix tools written in Go

#39
post #37
post #11

https://github.com/polegone/gonix/search?utf8=%E2%9C%93&q=re... Goodbye, memory.

I don't know much about go, but taking a quick look at implementations - they seem to be written by a programming novice, and the are quite primitive. Don't mean to be negative, just my opinion.

I am a novice, and that is one of the reasons why I started this project (to learn).

Re: Gonix – Unix tools written in Go

#40

Earlier quoted context omitted.

No problem. Also, please do not ignore errors. They're meant to be handled.

I'm working on that as well. I just fixed cat to crash and log on error, and I'll be fixing the other commands soon. By the way, I'm wondering how I should go through the file line by line with a reader. I think the most efficient way may be to scan byte by byte from the start (head) or the end (tail), and count until reaching n amount of newlines (or stop if at the end of the file), then print the bytes between the…

> By the way, I'm wondering how I should go through the file line by line with a reader.

Take a look at my Go package that allows you to programmatically do 'tail -f' - https://github.com/activestate/tail

Post reply on HN