A cross-platform port of GNU's coreutils to Go
Go Shell
Switch branches/tags
Nothing to show
Clone or download
Latest commit 70e5762 Jan 17, 2018
Permalink
Failed to load latest commit information.
arch Not sure what *all* these changes are. Jan 27, 2016
base64 Merge pull request #98 from iamthemuffinman/master Aug 5, 2015
basename Merge pull request #98 from iamthemuffinman/master Aug 5, 2015
cal go fmt entire source tree Jul 20, 2015
cat wc + cat Mar 7, 2016
chcon Add package internal. Fix wc. Add users. Mar 7, 2016
chgrp Add package internal. Fix wc. Add users. Mar 7, 2016
chmod Add package internal. Fix wc. Add users. Mar 7, 2016
chown Not sure what *all* these changes are. Jan 27, 2016
chroot Add package internal. Fix wc. Add users. Mar 7, 2016
cksum Add package internal. Fix wc. Add users. Mar 7, 2016
comm Add package internal. Fix wc. Add users. Mar 7, 2016
cp pardon the dust. Jul 29, 2015
csplit Add package internal. Fix wc. Add users. Mar 7, 2016
cut Add package internal. Fix wc. Add users. Mar 7, 2016
date Add package internal. Fix wc. Add users. Mar 7, 2016
dd Add package internal. Fix wc. Add users. Mar 7, 2016
df Add package internal. Fix wc. Add users. Mar 7, 2016
dir Add package internal. Fix wc. Add users. Mar 7, 2016
dircolors Add package internal. Fix wc. Add users. Mar 7, 2016
dirname Add package internal. Fix wc. Add users. Mar 7, 2016
du Add package internal. Fix wc. Add users. Mar 7, 2016
echo Add package internal. Fix wc. Add users. Mar 7, 2016
env Fix for #109 Jan 27, 2016
expand Add package internal. Fix wc. Add users. Mar 7, 2016
expr Add package internal. Fix wc. Add users. Mar 7, 2016
factor Add package internal. Fix wc. Add users. Mar 7, 2016
false docs, wc, uptime, false: Minor changes to all May 13, 2015
fmt Add package internal. Fix wc. Add users. Mar 7, 2016
fold Add package internal. Fix wc. Add users. Mar 7, 2016
groups Add package internal. Fix wc. Add users. Mar 7, 2016
head Add package internal. Fix wc. Add users. Mar 7, 2016
hostid Add package internal. Fix wc. Add users. Mar 7, 2016
id Add package internal. Fix wc. Add users. Mar 7, 2016
install Add package internal. Fix wc. Add users. Mar 7, 2016
join Add package internal. Fix wc. Add users. Mar 7, 2016
link Add package internal. Fix wc. Add users. Mar 7, 2016
ln Add package internal. Fix wc. Add users. Mar 7, 2016
logname Not sure what *all* these changes are. Jan 27, 2016
ls Add package internal. Fix wc. Add users. Mar 7, 2016
md5sum add newline in comment, to let godoc display right Sep 25, 2015
mkdir Add package internal. Fix wc. Add users. Mar 7, 2016
mkfifo Add package internal. Fix wc. Add users. Mar 7, 2016
mknod Add package internal. Fix wc. Add users. Mar 7, 2016
mktemp Add package internal. Fix wc. Add users. Mar 7, 2016
mv Add package internal. Fix wc. Add users. Mar 7, 2016
nice Add package internal. Fix wc. Add users. Mar 7, 2016
nl go fmt entire source tree Jul 20, 2015
nohup Add package internal. Fix wc. Add users. Mar 7, 2016
nproc Add package internal. Fix wc. Add users. Mar 7, 2016
numfmt Add package internal. Fix wc. Add users. Mar 7, 2016
od Add package internal. Fix wc. Add users. Mar 7, 2016
paste Add package internal. Fix wc. Add users. Mar 7, 2016
pathchk Add package internal. Fix wc. Add users. Mar 7, 2016
pinky Add package internal. Fix wc. Add users. Mar 7, 2016
pr Add package internal. Fix wc. Add users. Mar 7, 2016
printenv Add package internal. Fix wc. Add users. Mar 7, 2016
printf Add package internal. Fix wc. Add users. Mar 7, 2016
ptx Add package internal. Fix wc. Add users. Mar 7, 2016
pwd Not sure what *all* these changes are. Jan 27, 2016
readlink Add package internal. Fix wc. Add users. Mar 7, 2016
realpath Add package internal. Fix wc. Add users. Mar 7, 2016
rm rm: add rm implementation Jan 17, 2018
rmdir Add package internal. Fix wc. Add users. Mar 7, 2016
runcon Add package internal. Fix wc. Add users. Mar 7, 2016
seq go fmt entire source tree Jul 20, 2015
sha1sum add newline in comment, to let godoc display right Sep 25, 2015
sha224sum add newline in comment, to let godoc display right Sep 25, 2015
sha256sum add newline in comment, to let godoc display right Sep 25, 2015
sha384sum add newline in comment, to let godoc display right Sep 25, 2015
sha512sum add newline in comment, to let godoc display right Sep 25, 2015
shred Add package internal. Fix wc. Add users. Mar 7, 2016
shuf Add package internal. Fix wc. Add users. Mar 7, 2016
sleep implement sleep Jul 1, 2017
sort Add package internal. Fix wc. Add users. Mar 7, 2016
split Add package internal. Fix wc. Add users. Mar 7, 2016
stat Add package internal. Fix wc. Add users. Mar 7, 2016
stdbuf Add package internal. Fix wc. Add users. Mar 7, 2016
stty Add package internal. Fix wc. Add users. Mar 7, 2016
sum Add package internal. Fix wc. Add users. Mar 7, 2016
sync Not sure what *all* these changes are. Jan 27, 2016
tac Add package internal. Fix wc. Add users. Mar 7, 2016
tail Add package internal. Fix wc. Add users. Mar 7, 2016
tee go fmt entire source tree Jul 20, 2015
test Add package internal. Fix wc. Add users. Mar 7, 2016
timeout Add package internal. Fix wc. Add users. Mar 7, 2016
touch Put os.Stat back to follow symlinks through Jul 21, 2015
tr Add package internal. Fix wc. Add users. Mar 7, 2016
true Added true May 4, 2015
truncate Add package internal. Fix wc. Add users. Mar 7, 2016
tsort Not sure what *all* these changes are. Jan 27, 2016
tty Not sure what *all* these changes are. Jan 27, 2016
uname uname: Added proper -o, --operating-system switch. Fixed internal/flag Mar 7, 2016
unexpand Add package internal. Fix wc. Add users. Mar 7, 2016
uniq Add package internal. Fix wc. Add users. Mar 7, 2016
unlink Add package internal. Fix wc. Add users. Mar 7, 2016
uptime Not sure what *all* these changes are. Jan 27, 2016
users Add package internal. Fix wc. Add users. Mar 7, 2016
vdir Add package internal. Fix wc. Add users. Mar 7, 2016
wc rm: add rm implementation Jan 17, 2018
who Not sure what *all* these changes are. Jan 27, 2016
whoami Not sure what *all* these changes are. Jan 27, 2016
xxd pardon the dust. Jul 29, 2015
yes wc: test new wc implementation Jan 13, 2018
.git.go pardon the dust. Jul 29, 2015
.gitignore wc: use function instead of interface, call fadv if actually reading Jan 15, 2018
CONTRIBUTING.md Not sure what *all* these changes are. Jan 27, 2016
LICENSE.txt finished cat, working on ioctl... Mar 23, 2015
README.md Add a more specific completion metric for first glances. Oct 31, 2016
THANKS.md chown: refactoring from ground up Jul 29, 2015
build.bash began build script Jul 28, 2015
coreutils.go rm: add rm implementation Jan 17, 2018
editlicensedates.bash some cleanup Jul 29, 2015

README.md

Go coreutils

forthebadge forthebadge

This is a port of GNU's coreutils (http://www.gnu.org/software/coreutils/) that aims to be a drop-in, cross-platform replacement.

It's currently under development.

Because it imports from github.com/EricLagergren/go-gnulib, and I'm constantly refactoring, parts could break from day-to-day.

I'd recommend running go get -u ... before you file a bug report!

Pull requests are more than welcome.

Also, see https://www.github.com/EricLagergren/go-gnulib for a similar project that this project depends on.

Completed:

  • 100% Completion
  • 15/100
  • Partial Completion
  • 2/100
Utility Completeness Cross Platform Need Refactor
cat 100% Yes (Unix/Windows) No
chown 0% (* see note #1) No Yes (-R)
env 100% Yes (Unix/Windows) No
false 100% Yes (Unix/Windows) No
logname 100% No No
pwd 100% Yes (Unknown) No
sync 100% Yes (Unix/Windows) No
true 100% Yes (Unix/Windows) No
tsort 100% Yes (Unix/Windows) No
tty 100% Yes (Unix/Windows) No
uname 100% No No
uptime 90% Yes (Unix/Windows, no FreeBSD) No
users 100% No No
wc 100% Yes (Unix/Windows) No
whoami 100% Yes (Unix/Windows No
xxd 100% Yes (Unix/Windows) No
yes 100% Yes (Unix/Windows) No
  • chown note: Currently refactoring from the ground-up.

Side notes:

  • Unix should include OS X unless otherwise specified.
  • Gofmt means it needs its styling changes (e.g. variable names, formatting, etc.)
  • Idiomatic means it needs to be changed to more idiomatic Go
  • Windows coverage will increase when I get a Windows laptop

Information:

Performance:

Obviously there's some things Go can do better (parallelism and concurrency), but for the most part these tools should have nearly the same speed, with Go being slightly slower.

eric@archbox $ time ./wc_go -lwmc one_gigabyte_file.txt 
  32386258  146084896 1182425560 1183778772 one_gigabyte_file.txt

real  0m25.206s
user  0m24.900s
sys   0m0.313s
eric@archbox $ time wc_c -lwmc one_gigabyte_file.txt 
  32386258  146084896 1182425560 1183778772 one_gigabyte_file.txt

real  0m22.841s
user  0m22.570s
sys   0m0.257s

Behavior:

These utilities should be nearly identical to GNU's coreutils.

Since parsing the output of shell commands isn't uncommon (even if it is bad behavior), most of the commands should have output that is nearly identical to the original GNU commands.

Do note that sometimes the results could differ a little for select commands.

For example, GNU's wc utility relies on the current locale to determine whether it should parse multi-byte characters or not.

The Go version, on the other hand, uses the unicode/utf8 package which natively detects multi-byte sequences. The trade-off is this: the Go version is technically more correct, while the C version is faster.

Our implementation of xxd is actually much faster than the native xxd implementation found on most *nix machines -- try it out!

REQUIRES:

(Depends on platform and command...)

  • go get github.com/EricLagergren/ostypes
  • go get golang.org/x/sys/unix
  • go get github.com/EricLagergren/go-gnulib/ttyname
  • go get github.com/EricLagergren/go-gnulib/sysinfo
  • go get github.com/EricLagergren/go-gnulib/posix
  • go get github.com/EricLagergren/go-gnulib/general
  • go get github.com/EricLagergren/go-gnulib/login

LICENSE:

   Copyright (C) 2014-2016 Eric Lagergren

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.

License subnotes:

It (as a whole) is licensed under the GPLv3 because it's mostly a transliteration of GNU's coreutils, which are licensed under the GPLv3.

However, certain parts have their own licenses (e.g., xxd is public domain).