From d1e82077ac9dee423676eb29bd3828c4076210f9 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Sun, 23 Sep 2012 14:30:42 -0700 Subject: [PATCH] some manual renames --- .../concurrent-goroutines.go | 0 .../channel-buffering.go | 0 .../channel-directions.go | 0 .../burstable-rate-limiting.go | 27 ------------------- .../worker-pools.go | 2 +- 046-sort/sort.sh | 5 ---- 046-sort/sort.go => 046-sorting/sorting.go | 2 +- 046-sorting/sorting.sh | 5 ++++ .../sorting-by-functions.go | 2 +- .../sorting-by-functions.sh | 2 +- 055-epoch/epoch.go => 055-epochs/epochs.go | 2 +- 055-epoch/epoch.sh => 055-epochs/epochs.sh | 2 +- .../measuring-elapsed-time.go | 2 +- .../random-numbers.go | 2 +- .../random-numbers.sh | 2 +- .../collection-functions.go | 4 ++- tool/index.txt | 21 +++++++-------- 17 files changed, 27 insertions(+), 53 deletions(-) rename 035-concurrency/concurrency.go => 035-concurrent-goroutines/concurrent-goroutines.go (100%) rename 037-buffering/buffering.go => 037-channel-buffering/channel-buffering.go (100%) rename 038-directions/directions.go => 038-channel-directions/channel-directions.go (100%) delete mode 100644 044-burstable-rate-limiting/burstable-rate-limiting.go rename 045-worker-pool/worker-pool.go => 045-worker-pools/worker-pools.go (96%) delete mode 100644 046-sort/sort.sh rename 046-sort/sort.go => 046-sorting/sorting.go (98%) create mode 100644 046-sorting/sorting.sh rename 047-sort-by-function/sort-by-function.go => 047-sorting-by-functions/sorting-by-functions.go (96%) rename 047-sort-by-function/sort-by-function.sh => 047-sorting-by-functions/sorting-by-functions.sh (78%) rename 055-epoch/epoch.go => 055-epochs/epochs.go (96%) rename 055-epoch/epoch.sh => 055-epochs/epochs.sh (75%) rename 056-elapsed/elapsed.go => 056-measuring-elapsed-time/measuring-elapsed-time.go (82%) rename 059-rand/rand.go => 059-random-numbers/random-numbers.go (98%) rename 059-rand/rand.sh => 059-random-numbers/random-numbers.sh (56%) rename 061-enumerable/enumerable.go => 061-collection-functions.go/collection-functions.go (97%) diff --git a/035-concurrency/concurrency.go b/035-concurrent-goroutines/concurrent-goroutines.go similarity index 100% rename from 035-concurrency/concurrency.go rename to 035-concurrent-goroutines/concurrent-goroutines.go diff --git a/037-buffering/buffering.go b/037-channel-buffering/channel-buffering.go similarity index 100% rename from 037-buffering/buffering.go rename to 037-channel-buffering/channel-buffering.go diff --git a/038-directions/directions.go b/038-channel-directions/channel-directions.go similarity index 100% rename from 038-directions/directions.go rename to 038-channel-directions/channel-directions.go diff --git a/044-burstable-rate-limiting/burstable-rate-limiting.go b/044-burstable-rate-limiting/burstable-rate-limiting.go deleted file mode 100644 index 4c19bcd..0000000 --- a/044-burstable-rate-limiting/burstable-rate-limiting.go +++ /dev/null @@ -1,27 +0,0 @@ -// ## Burstable Rate Limiting - -package main - -import "time" -import "fmt" - -func main() { - tick := time.Tick(time.Millisecond * 200) - throttle := make(chan bool, 10) - go func() { - for { - <- tick - select { - case throttle <- true: - default: - } - } - }() - time.Sleep(time.Millisecond * 1000) - for { - <- throttle - go fmt.Println("acting") - } -} - -// todo: credit http://code.google.com/p/go-wiki/wiki/RateLimiting diff --git a/045-worker-pool/worker-pool.go b/045-worker-pools/worker-pools.go similarity index 96% rename from 045-worker-pool/worker-pool.go rename to 045-worker-pools/worker-pools.go index 4d72646..a76b6e5 100644 --- a/045-worker-pool/worker-pool.go +++ b/045-worker-pools/worker-pools.go @@ -1,4 +1,4 @@ -// ## Worker Pool +// ## Worker Pools package main diff --git a/046-sort/sort.sh b/046-sort/sort.sh deleted file mode 100644 index 007e887..0000000 --- a/046-sort/sort.sh +++ /dev/null @@ -1,5 +0,0 @@ -$ go run sort.go -[a b c] -[2 4 7] -true -1 \ No newline at end of file diff --git a/046-sort/sort.go b/046-sorting/sorting.go similarity index 98% rename from 046-sort/sort.go rename to 046-sorting/sorting.go index 22325b8..98d3085 100644 --- a/046-sort/sort.go +++ b/046-sorting/sorting.go @@ -1,4 +1,4 @@ -// ## Sort +// ## Sorting // The `sort` package implements sorting for builtins // and user-defined types. We'll look at some of the diff --git a/046-sorting/sorting.sh b/046-sorting/sorting.sh new file mode 100644 index 0000000..bd7ca06 --- /dev/null +++ b/046-sorting/sorting.sh @@ -0,0 +1,5 @@ +$ go run sorting.go +[a b c] +[2 4 7] +true +1 diff --git a/047-sort-by-function/sort-by-function.go b/047-sorting-by-functions/sorting-by-functions.go similarity index 96% rename from 047-sort-by-function/sort-by-function.go rename to 047-sorting-by-functions/sorting-by-functions.go index c2eb729..4c8c317 100644 --- a/047-sort-by-function/sort-by-function.go +++ b/047-sorting-by-functions/sorting-by-functions.go @@ -1,4 +1,4 @@ -// ## Sort by Function +// ## Sorting by Functions package main diff --git a/047-sort-by-function/sort-by-function.sh b/047-sorting-by-functions/sorting-by-functions.sh similarity index 78% rename from 047-sort-by-function/sort-by-function.sh rename to 047-sorting-by-functions/sorting-by-functions.sh index 46a6476..7610d44 100644 --- a/047-sort-by-function/sort-by-function.sh +++ b/047-sorting-by-functions/sorting-by-functions.sh @@ -1,4 +1,4 @@ -$ go run sort-by-function.go +$ go run sorting-by-function.go Original: [{Jack 10} {Jill 9} {Bob 12}] ByName: [{Bob 12} {Jack 10} {Jill 9}] ByAge: [{Jill 9} {Jack 10} {Bob 12}] diff --git a/055-epoch/epoch.go b/055-epochs/epochs.go similarity index 96% rename from 055-epoch/epoch.go rename to 055-epochs/epochs.go index 6eb3cc2..c5cad5c 100644 --- a/055-epoch/epoch.go +++ b/055-epochs/epochs.go @@ -1,4 +1,4 @@ -// ## Epoch +// ## Epochs package main diff --git a/055-epoch/epoch.sh b/055-epochs/epochs.sh similarity index 75% rename from 055-epoch/epoch.sh rename to 055-epochs/epochs.sh index 2c1048c..981281c 100644 --- a/055-epoch/epoch.sh +++ b/055-epochs/epochs.sh @@ -1,4 +1,4 @@ -$ go run 051-epoch.go +$ go run epochs.go Secs: 1348240948 Millis: 1348240948517 Nanos: 1348240948517870000 diff --git a/056-elapsed/elapsed.go b/056-measuring-elapsed-time/measuring-elapsed-time.go similarity index 82% rename from 056-elapsed/elapsed.go rename to 056-measuring-elapsed-time/measuring-elapsed-time.go index 66345a1..5d5af60 100644 --- a/056-elapsed/elapsed.go +++ b/056-measuring-elapsed-time/measuring-elapsed-time.go @@ -1,4 +1,4 @@ -// ## Elapsed Time +// ## Measuring Elapsed Time package main diff --git a/059-rand/rand.go b/059-random-numbers/random-numbers.go similarity index 98% rename from 059-rand/rand.go rename to 059-random-numbers/random-numbers.go index cebe697..e857c9b 100644 --- a/059-rand/rand.go +++ b/059-random-numbers/random-numbers.go @@ -1,4 +1,4 @@ -// Rand +// Random Numbers package main diff --git a/059-rand/rand.sh b/059-random-numbers/random-numbers.sh similarity index 56% rename from 059-rand/rand.sh rename to 059-random-numbers/random-numbers.sh index 1f9f06f..0751104 100644 --- a/059-rand/rand.sh +++ b/059-random-numbers/random-numbers.sh @@ -1,4 +1,4 @@ -$ go run rand.go +$ go run random-numbers.go 81,87 0.6645600532184904 5,87 diff --git a/061-enumerable/enumerable.go b/061-collection-functions.go/collection-functions.go similarity index 97% rename from 061-enumerable/enumerable.go rename to 061-collection-functions.go/collection-functions.go index e126825..20cb9e6 100644 --- a/061-enumerable/enumerable.go +++ b/061-collection-functions.go/collection-functions.go @@ -1,4 +1,4 @@ -// ## Enumerable +// ## Collection Functions package main @@ -91,3 +91,5 @@ func main() { })) fmt.Println() } + +// todo: generics diff --git a/tool/index.txt b/tool/index.txt index d0f9263..fe2b6ca 100644 --- a/tool/index.txt +++ b/tool/index.txt @@ -40,23 +40,22 @@ errors # concurrency goroutines -concurrency +concurrent-goroutines channels -buffering -directions +channel-buffering +channel-directions synchronization select timeouts scatter-gather rate-limiting -burstable-rate-limiting -worker-pool +worker-pools ~ nonblocking-sends-and-receives ~ closing-channels # core libraries -sort -sort-by-function +sorting +sorting-by-functions string-functions string-formatting regexs @@ -65,13 +64,13 @@ json ~ typed-json time ~ time-formatting -epoch -elapsed +epochs +measuring-elapsed-time timers tickers -rand +random-numbers number-parsing -enumerable +collection-functions urls sha1-hashes ~ base64-encoding