Skip to content
/ go-wc Public

Go implementation of the Unix CLI tool wc and the solution for the first challenge of Coding Challenges.

License

Notifications You must be signed in to change notification settings

alefeans/go-wc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-wc

go-wc is a Go implementation of the Unix CLI tool wc and the solution for the first challenge of Coding Challenges.

Step 1

wc -c test.txt
335040 test.txt

go run main.go -c test.txt
335040 test.txt

Step 2

wc -l test.txt
7143 test.txt

go run main.go -l test.txt
7143 test.txt

Step 3

wc -w test.txt
58164 test.txt

go run main.go -w test.txt
58164 test.txt

Step 4

wc -m test.txt
332144 test.txt

go run main.go -m test.txt
332144 test.txt

Step 5

wc test.txt
7143 58164 335040 test.txt

go run main.go test.txt
7143 58164 335040 test.txt

Step 6

cat test.txt | wc
7143 58164 335040

cat test.txt | go run main.go
7143 58164 335040

Tests

go test -v

=== RUN   TestCountAll
--- PASS: TestCountAll (0.00s)
PASS
ok      github.com/alefeans/go-wc       0.080s

Benchmarks

go test -bench=. -benchmem

goos: darwin
goarch: arm64
pkg: github.com/alefeans/go-wc
BenchmarkCountAllSimpleInput-10          3123913               384.7 ns/op          4128 B/op             2 allocs/op
BenchmarkCountAllTestFile-10             1566600               757.4 ns/op          4128 B/op             2 allocs/op
PASS
ok      github.com/alefeans/go-wc       3.698s

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Go implementation of the Unix CLI tool wc and the solution for the first challenge of Coding Challenges.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages