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.
Gonix – Unix tools written in Go
41–50 of 85 posts
Re: Gonix – Unix tools written in Go
#42Earlier 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.
It would be great if complete coreutils was implemented!
Re: Gonix – Unix tools written in Go
#43Forget 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
If it turns out to be more widely used, at least it's safer than C code.
Re: Gonix – Unix tools written in Go
#44Earlier 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
#45Earlier 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).
Re: Gonix – Unix tools written in Go
#46Forget 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.
Re: Gonix – Unix tools written in Go
#47Earlier 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 :).
Re: Gonix – Unix tools written in Go
#48Forget 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.
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
#49Nice, 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.
Re: Gonix – Unix tools written in Go
#50Forget 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.