Live data from Hacker News

Gonix – Unix tools written in Go

github.com

41–50 of 85 posts

Re: Gonix – Unix tools written in Go

#41
post #9

There is no reason to ever want to do this.

I'm just doing this for fun and to learn about Go and Unix at the same time. I am a beginner, and a lot of my code is inefficient and/or incomplete, but by putting it on the Internet I can get criticism and find out where I went wrong. For instance, some of you have told me that the way I've been reading files is very inefficient, so now I'll try and do it the correct way.

That is the best reason. I am glad HN has people like you who are not afraid to put yourself out there and reminds us all that this is what being a hacker is: doing stuff for fun and learning.

Re: Gonix – Unix tools written in Go

#42

Earlier quoted context omitted.

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.

Work together!

It would be great if complete coreutils was implemented!

Re: Gonix – Unix tools written in Go

#43
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

What's wrong with doing this for fun's sake or educational value (both for the authors or people who want to study Go)?

If it turns out to be more widely used, at least it's safer than C code.

Re: Gonix – Unix tools written in Go

#44
post #37

Earlier quoted context omitted.

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).

    bytes, _ := ioutil.ReadAll(os.Stdin)
    lines := strings.Split(string(bytes), "\n")
Tip: use bufio.Scanner.

    scanner := bufio.NewScanner(reader)
    scanner.Split(bufio.ScanLines)
    for scanner.Scan() {
      // Do stuff
    }
And you can iterate over the lines 'lazily'. If you don't want to consume \r's, make your own ScanLines :).

Re: Gonix – Unix tools written in Go

#45
post #37

Earlier quoted context omitted.

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).

Great going. This will also help other novice Go programmers learning the language, at the same time getting a sense of how to implement their own Unix commands.

Re: Gonix – Unix tools written in Go

#46
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.

We really need a busybox in Rust or Go. The existing one has licensing problems and security problems, and is built into too many embedded devices.

Re: Gonix – Unix tools written in Go

#47

Earlier quoted context omitted.

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

bytes, _ := ioutil.ReadAll(os.Stdin) lines := strings.Split(string(bytes), "\n") Tip: use bufio.Scanner. scanner := bufio.NewScanner(reader) scanner.Split(bufio.ScanLines) for scanner.Scan() { // Do stuff } And you can iterate over the lines 'lazily'. If you don't want to consume \r's, make your own ScanLines :).

[deleted]

Re: Gonix – Unix tools written in Go

#48
post #46
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.

We really need a busybox in Rust or Go. The existing one has licensing problems and security problems, and is built into too many embedded devices.

Busybox is GPLv2. That's the same license as the linux kernel; it's not a problem. You just have to release your modified version of the busybox source if you distribute it in a product. The only difference is that busybox developers enforce the license against the many companies who can't be bothered and respond to requests with lawyers.

That said, a bsd-licensed re-implementation of busybox (still in c) that's pretty far along and has gotten support from some of those companies (including Sony) is "toybox" http://www.landley.net/toybox/

Re: Gonix – Unix tools written in Go

#49

Nice, I was thinking of doing something like that, but I don't know as many unix tools as the author does. :-P

I rewrote "pause" from Windows into my Ubuntu box out of habit of using it in some cases. First it was written in perl, then in Python, I also symlink clear as cls out of habit from Windows. There's small little "hacks" that you can do that are kind of fun.

Windows' cls actually erases the buffer from previous commands (so you can't scroll up past it), clear does not. I alias "cls=printf '\033c'" to get the Windows behavior.

Re: Gonix – Unix tools written in Go

#50
post #46
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.

We really need a busybox in Rust or Go. The existing one has licensing problems and security problems, and is built into too many embedded devices.

What licensing problems specifically do you mean here?
Post reply on HN