Решение на Concurrent Retry Executor от Стоян Иванов

Обратно към всички решения

Към профила на Стоян Иванов

Резултати

  • 1 точка от тестове
  • 0 бонус точки
  • 1 точка общо
  • 1 успешни тест(а)
  • 7 неуспешни тест(а)

Код

package main
import (
"fmt"
"strconv"
)
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string, 100)
go func(result chan string) {
chanIndex := 1
for val := range logs {
go func() {
for str := range val {
result <- strconv.Itoa(chanIndex) + "\t" + str
}
chanIndex++
}()
}
close(result)
}(result)
return result
}
func main() {
logs := make(chan (chan string))
orderedLog := OrderedLogDrainer(logs)
first := make(chan string)
logs <- first
second := make(chan string)
logs <- second
first <- "test message 1 in first"
second <- "test message 1 in second"
second <- "test message 2 in second"
first <- "test message 2 in first"
first <- "test message 3 in first"
// Print the first message now just because we can
fmt.Println(<-orderedLog)
third := make(chan string)
logs <- third
third <- "test message 1 in third"
first <- "test message 4 in first"
close(first)
second <- "test message 3 in second"
close(third)
close(logs)
second <- "test message 4 in second"
close(second)
// Print all the rest of the messages
for logEntry := range orderedLog {
fmt.Println(logEntry)
}
}

Лог от изпълнението

panic: send on closed channel

goroutine 24 [running]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc820072038, 0xc820060360, 0xc8200625c0)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 1 [chan receive]:
testing.RunTests(0x5d4918, 0x65eba0, 0x8, 0x8, 0x1)
	/usr/local/go/src/testing/testing.go:582 +0x558
testing.(*M).Run(0xc82003fef8, 0xc820062510)
	/usr/local/go/src/testing/testing.go:494 +0x70
main.main()
	_/tmp/d20151110-19113-emq47t/_test/_testmain.go:68 +0x116

goroutine 20 [select]:
_/tmp/d20151110-19113-emq47t.withTimeout(0xc8200a2000, 0x1dcd6500, 0xc8200625a0)
	/tmp/d20151110-19113-emq47t/solution_test.go:24 +0x262
_/tmp/d20151110-19113-emq47t.TestWithOneMessage(0xc8200a2000)
	/tmp/d20151110-19113-emq47t/solution_test.go:64 +0x77
testing.tRunner(0xc8200a2000, 0x65eba0)
	/usr/local/go/src/testing/testing.go:456 +0x98
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:561 +0x86d

goroutine 21 [chan receive]:
testing.RunTests.func1(0xc8200600c0, 0xc8200a2000)
	/usr/local/go/src/testing/testing.go:565 +0x47
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:566 +0x90e

goroutine 22 [runnable]:
_/tmp/d20151110-19113-emq47t.TestWithOneMessage.func1()
	/tmp/d20151110-19113-emq47t/solution_test.go:63 +0x19d
_/tmp/d20151110-19113-emq47t.withTimeout.func1(0xc8200a2000, 0xc820060240, 0xc8200625a0)
	/tmp/d20151110-19113-emq47t/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-emq47t.withTimeout
	/tmp/d20151110-19113-emq47t/solution_test.go:22 +0x7c
exit status 2
FAIL	_/tmp/d20151110-19113-emq47t	0.005s
panic: send on closed channel

goroutine 11 [running]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 1 [runnable]:
os.(*File).Write(0xc82002c010, 0xc82002f680, 0x429, 0x480, 0x4, 0x4, 0x7fb8a1a54570)
	/usr/local/go/src/os/file.go:135
fmt.Fprintf(0x7fb8a1a54570, 0xc82002c010, 0x5a8ef0, 0x12, 0xc82003fc08, 0x4, 0x4, 0x40c370, 0x0, 0x0)
	/usr/local/go/src/fmt/print.go:189 +0xb2
fmt.Printf(0x5a8ef0, 0x12, 0xc82003fc08, 0x4, 0x4, 0x2, 0x0, 0x0)
	/usr/local/go/src/fmt/print.go:197 +0x94
testing.(*T).report(0xc82008e000)
	/usr/local/go/src/testing/testing.go:512 +0x2ed
testing.RunTests(0x5d4918, 0x65eba0, 0x8, 0x8, 0x1)
	/usr/local/go/src/testing/testing.go:583 +0x585
testing.(*M).Run(0xc82003fef8, 0xc820010650)
	/usr/local/go/src/testing/testing.go:494 +0x70
main.main()
	_/tmp/d20151110-19113-emq47t/_test/_testmain.go:68 +0x116
exit status 2
FAIL	_/tmp/d20151110-19113-emq47t	0.007s
panic: send on closed channel

goroutine 25 [running]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc820072038, 0xc820060360, 0xc8200625d0)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 1 [chan receive]:
testing.RunTests(0x5d4918, 0x65eba0, 0x8, 0x8, 0x1)
	/usr/local/go/src/testing/testing.go:582 +0x558
testing.(*M).Run(0xc82003fef8, 0xc820062510)
	/usr/local/go/src/testing/testing.go:494 +0x70
main.main()
	_/tmp/d20151110-19113-emq47t/_test/_testmain.go:68 +0x116

goroutine 20 [select]:
_/tmp/d20151110-19113-emq47t.withTimeout(0xc8200a0000, 0x1dcd6500, 0xc820066390)
	/tmp/d20151110-19113-emq47t/solution_test.go:24 +0x262
_/tmp/d20151110-19113-emq47t.TestWithExample2(0xc8200a0000)
	/tmp/d20151110-19113-emq47t/solution_test.go:138 +0x11e
testing.tRunner(0xc8200a0000, 0x65ebd0)
	/usr/local/go/src/testing/testing.go:456 +0x98
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:561 +0x86d

goroutine 21 [chan receive]:
testing.RunTests.func1(0xc8200600c0, 0xc8200a0000)
	/usr/local/go/src/testing/testing.go:565 +0x47
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:566 +0x90e

goroutine 22 [chan send]:
_/tmp/d20151110-19113-emq47t.TestWithExample2.func1()
	/tmp/d20151110-19113-emq47t/solution_test.go:134 +0x1e9
_/tmp/d20151110-19113-emq47t.withTimeout.func1(0xc8200a0000, 0xc820060240, 0xc820066390)
	/tmp/d20151110-19113-emq47t/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-emq47t.withTimeout
	/tmp/d20151110-19113-emq47t/solution_test.go:22 +0x7c

goroutine 24 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc820072038, 0xc820060360, 0xc8200625d0)
	/tmp/d20151110-19113-emq47t/solution.go:16 +0x5f
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1
exit status 2
FAIL	_/tmp/d20151110-19113-emq47t	0.006s
PASS
ok  	_/tmp/d20151110-19113-emq47t	0.003s
--- FAIL: TestWithTwoEmptyLogs (0.00s)
	solution_test.go:40: Received log entry #0 with contents '1	bbb' when expecting '3	aaa'
	solution_test.go:40: Received log entry #1 with contents '2	aaa' when expecting '3	bbb'
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-emq47t	0.004s
panic: send on closed channel

goroutine 18 [running]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc8200a2000, 0xc82001e3c0, 0xc8200a0000)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 1 [chan receive]:
testing.RunTests(0x5d4918, 0x65eba0, 0x8, 0x8, 0x1)
	/usr/local/go/src/testing/testing.go:582 +0x558
testing.(*M).Run(0xc82003fef8, 0xc820010650)
	/usr/local/go/src/testing/testing.go:494 +0x70
main.main()
	_/tmp/d20151110-19113-emq47t/_test/_testmain.go:68 +0x116

goroutine 6 [select]:
_/tmp/d20151110-19113-emq47t.withTimeout(0xc82008c000, 0x35a4e900, 0xc820010700)
	/tmp/d20151110-19113-emq47t/solution_test.go:24 +0x262
_/tmp/d20151110-19113-emq47t.TestWithDelays(0xc82008c000)
	/tmp/d20151110-19113-emq47t/solution_test.go:206 +0x77
testing.tRunner(0xc82008c000, 0x65ec18)
	/usr/local/go/src/testing/testing.go:456 +0x98
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:561 +0x86d

goroutine 7 [chan receive]:
testing.RunTests.func1(0xc82001e120, 0xc82008c000)
	/usr/local/go/src/testing/testing.go:565 +0x47
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:566 +0x90e

goroutine 8 [chan send]:
_/tmp/d20151110-19113-emq47t.TestWithDelays.func1()
	/tmp/d20151110-19113-emq47t/solution_test.go:199 +0x210
_/tmp/d20151110-19113-emq47t.withTimeout.func1(0xc82008c000, 0xc82001e2a0, 0xc820010700)
	/tmp/d20151110-19113-emq47t/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-emq47t.withTimeout
	/tmp/d20151110-19113-emq47t/solution_test.go:22 +0x7c

goroutine 17 [chan receive]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc8200a2000, 0xc82001e3c0, 0xc8200a0000)
	/tmp/d20151110-19113-emq47t/solution.go:16 +0x5f
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1
exit status 2
FAIL	_/tmp/d20151110-19113-emq47t	0.708s
--- FAIL: TestTheLimits (0.00s)
	solution_test.go:38: Channel was closed when we expected to receive entry #0 with contents '1	Ni 001'
	solution_test.go:38: Channel was closed when we expected to receive entry #1 with contents '1	Ni 002'
	solution_test.go:38: Channel was closed when we expected to receive entry #2 with contents '1	Ni 003'
	solution_test.go:38: Channel was closed when we expected to receive entry #3 with contents '1	Ni 004'
	solution_test.go:38: Channel was closed when we expected to receive entry #4 with contents '1	Ni 005'
	solution_test.go:38: Channel was closed when we expected to receive entry #5 with contents '1	Ni 006'
	solution_test.go:38: Channel was closed when we expected to receive entry #6 with contents '1	Ni 007'
	solution_test.go:38: Channel was closed when we expected to receive entry #7 with contents '1	Ni 008'
	solution_test.go:38: Channel was closed when we expected to receive entry #8 with contents '1	Ni 009'
	solution_test.go:38: Channel was closed when we expected to receive entry #9 with contents '1	Ni 010'
	solution_test.go:38: Channel was closed when we expected to receive entry #10 with contents '1	Ni 011'
	solution_test.go:38: Channel was closed when we expected to receive entry #11 with contents '1	Ni 012'
	solution_test.go:38: Channel was closed when we expected to receive entry #12 with contents '1	Ni 013'
	solution_test.go:38: Channel was closed when we expected to receive entry #13 with contents '1	Ni 014'
	solution_test.go:38: Channel was closed when we expected to receive entry #14 with contents '1	Ni 015'
	solution_test.go:38: Channel was closed when we expected to receive entry #15 with contents '1	Ni 016'
	solution_test.go:38: Channel was closed when we expected to receive entry #16 with contents '1	Ni 017'
	solution_test.go:38: Channel was closed when we expected to receive entry #17 with contents '1	Ni 018'
	solution_test.go:38: Channel was closed when we expected to receive entry #18 with contents '1	Ni 019'
	solution_test.go:38: Channel was closed when we expected to receive entry #19 with contents '1	Ni 020'
	solution_test.go:38: Channel was closed when we expected to receive entry #20 with contents '1	Ni 021'
	solution_test.go:38: Channel was closed when we expected to receive entry #21 with contents '1	Ni 022'
	solution_test.go:38: Channel was closed when we expected to receive entry #22 with contents '1	Ni 023'
	solution_test.go:38: Channel was closed when we expected to receive entry #23 with contents '1	Ni 024'
	solution_test.go:38: Channel was closed when we expected to receive entry #24 with contents '1	Ni 025'
	solution_test.go:38: Channel was closed when we expected to receive entry #25 with contents '1	Ni 026'
	solution_test.go:38: Channel was closed when we expected to receive entry #26 with contents '1	Ni 027'
	solution_test.go:38: Channel was closed when we expected to receive entry #27 with contents '1	Ni 028'
	solution_test.go:38: Channel was closed when we expected to receive entry #28 with contents '1	Ni 029'
	solution_test.go:38: Channel was closed when we expected to receive entry #29 with contents '1	Ni 030'
	solution_test.go:38: Channel was closed when we expected to receive entry #30 with contents '1	Ni 031'
	solution_test.go:38: Channel was closed when we expected to receive entry #31 with contents '1	Ni 032'
	solution_test.go:38: Channel was closed when we expected to receive entry #32 with contents '1	Ni 033'
	solution_test.go:38: Channel was closed when we expected to receive entry #33 with contents '1	Ni 034'
	solution_test.go:38: Channel was closed when we expected to receive entry #34 with contents '1	Ni 035'
	solution_test.go:38: Channel was closed when we expected to receive entry #35 with contents '1	Ni 036'
	solution_test.go:38: Channel was closed when we expected to receive entry #36 with contents '1	Ni 037'
	solution_test.go:38: Channel was closed when we expected to receive entry #37 with contents '1	Ni 038'
	solution_test.go:38: Channel was closed when we expected to receive entry #38 with contents '1	Ni 039'
	solution_test.go:38: Channel was closed when we expected to receive entry #39 with contents '1	Ni 040'
	solution_test.go:38: Channel was closed when we expected to receive entry #40 with contents '1	Ni 041'
	solution_test.go:38: Channel was closed when we expected to receive entry #41 with contents '1	Ni 042'
	solution_test.go:38: Channel was closed when we expected to receive entry #42 with contents '1	Ni 043'
	solution_test.go:38: Channel was closed when we expected to receive entry #43 with contents '1	Ni 044'
	solution_test.go:38: Channel was closed when we expected to receive entry #44 with contents '1	Ni 045'
	solution_test.go:38: Channel was closed when we expected to receive entry #45 with contents '1	Ni 046'
	solution_test.go:38: Channel was closed when we expected to receive entry #46 with contents '1	Ni 047'
	solution_test.go:38: Channel was closed when we expected to receive entry #47 with contents '1	Ni 048'
	solution_test.go:38: Channel was closed when we expected to receive entry #48 with contents '1	Ni 049'
	solution_test.go:38: Channel was closed when we expected to receive entry #49 with contents '1	Ni 050'
	solution_test.go:38: Channel was closed when we expected to receive entry #50 with contents '1	Ni 051'
	solution_test.go:38: Channel was closed when we expected to receive entry #51 with contents '1	Ni 052'
	solution_test.go:38: Channel was closed when we expected to receive entry #52 with contents '1	Ni 053'
	solution_test.go:38: Channel was closed when we expected to receive entry #53 with contents '1	Ni 054'
	solution_test.go:38: Channel was closed when we expected to receive entry #54 with contents '1	Ni 055'
	solution_test.go:38: Channel was closed when we expected to receive entry #55 with contents '1	Ni 056'
	solution_test.go:38: Channel was closed when we expected to receive entry #56 with contents '1	Ni 057'
	solution_test.go:38: Channel was closed when we expected to receive entry #57 with contents '1	Ni 058'
	solution_test.go:38: Channel was closed when we expected to receive entry #58 with contents '1	Ni 059'
	solution_test.go:38: Channel was closed when we expected to receive entry #59 with contents '1	Ni 060'
	solution_test.go:38: Channel was closed when we expected to receive entry #60 with contents '1	Ni 061'
	solution_test.go:38: Channel was closed when we expected to receive entry #61 with contents '1	Ni 062'
	solution_test.go:38: Channel was closed when we expected to receive entry #62 with contents '1	Ni 063'
	solution_test.go:38: Channel was closed when we expected to receive entry #63 with contents '1	Ni 064'
	solution_test.go:38: Channel was closed when we expected to receive entry #64 with contents '1	Ni 065'
	solution_test.go:38: Channel was closed when we expected to receive entry #65 with contents '1	Ni 066'
	solution_test.go:38: Channel was closed when we expected to receive entry #66 with contents '1	Ni 067'
	solution_test.go:38: Channel was closed when we expected to receive entry #67 with contents '1	Ni 068'
	solution_test.go:38: Channel was closed when we expected to receive entry #68 with contents '1	Ni 069'
	solution_test.go:38: Channel was closed when we expected to receive entry #69 with contents '1	Ni 070'
	solution_test.go:38: Channel was closed when we expected to receive entry #70 with contents '1	Ni 071'
	solution_test.go:38: Channel was closed when we expected to receive entry #71 with contents '1	Ni 072'
	solution_test.go:38: Channel was closed when we expected to receive entry #72 with contents '1	Ni 073'
	solution_test.go:38: Channel was closed when we expected to receive entry #73 with contents '1	Ni 074'
	solution_test.go:38: Channel was closed when we expected to receive entry #74 with contents '1	Ni 075'
	solution_test.go:38: Channel was closed when we expected to receive entry #75 with contents '1	Ni 076'
	solution_test.go:38: Channel was closed when we expected to receive entry #76 with contents '1	Ni 077'
	solution_test.go:38: Channel was closed when we expected to receive entry #77 with contents '1	Ni 078'
	solution_test.go:38: Channel was closed when we expected to receive entry #78 with contents '1	Ni 079'
	solution_test.go:38: Channel was closed when we expected to receive entry #79 with contents '1	Ni 080'
	solution_test.go:38: Channel was closed when we expected to receive entry #80 with contents '1	Ni 081'
	solution_test.go:38: Channel was closed when we expected to receive entry #81 with contents '1	Ni 082'
	solution_test.go:38: Channel was closed when we expected to receive entry #82 with contents '1	Ni 083'
	solution_test.go:38: Channel was closed when we expected to receive entry #83 with contents '1	Ni 084'
	solution_test.go:38: Channel was closed when we expected to receive entry #84 with contents '1	Ni 085'
	solution_test.go:38: Channel was closed when we expected to receive entry #85 with contents '1	Ni 086'
	solution_test.go:38: Channel was closed when we expected to receive entry #86 with contents '1	Ni 087'
	solution_test.go:38: Channel was closed when we expected to receive entry #87 with contents '1	Ni 088'
	solution_test.go:38: Channel was closed when we expected to receive entry #88 with contents '1	Ni 089'
	solution_test.go:38: Channel was closed when we expected to receive entry #89 with contents '1	Ni 090'
	solution_test.go:38: Channel was closed when we expected to receive entry #90 with contents '1	Ni 091'
	solution_test.go:38: Channel was closed when we expected to receive entry #91 with contents '1	Ni 092'
	solution_test.go:38: Channel was closed when we expected to receive entry #92 with contents '1	Ni 093'
	solution_test.go:38: Channel was closed when we expected to receive entry #93 with contents '1	Ni 094'
	solution_test.go:38: Channel was closed when we expected to receive entry #94 with contents '1	Ni 095'
	solution_test.go:38: Channel was closed when we expected to receive entry #95 with contents '1	Ni 096'
	solution_test.go:38: Channel was closed when we expected to receive entry #96 with contents '1	Ni 097'
	solution_test.go:38: Channel was closed when we expected to receive entry #97 with contents '1	Ni 098'
	solution_test.go:38: Channel was closed when we expected to receive entry #98 with contents '1	Ni 099'
	solution_test.go:38: Channel was closed when we expected to receive entry #99 with contents '1	Ni 100'
	solution_test.go:38: Channel was closed when we expected to receive entry #100 with contents '2	Ni 001'
	solution_test.go:38: Channel was closed when we expected to receive entry #101 with contents '2	Ni 002'
	solution_test.go:38: Channel was closed when we expected to receive entry #102 with contents '2	Ni 003'
	solution_test.go:38: Channel was closed when we expected to receive entry #103 with contents '2	Ni 004'
	solution_test.go:38: Channel was closed when we expected to receive entry #104 with contents '2	Ni 005'
	solution_test.go:38: Channel was closed when we expected to receive entry #105 with contents '2	Ni 006'
	solution_test.go:38: Channel was closed when we expected to receive entry #106 with contents '2	Ni 007'
	solution_test.go:38: Channel was closed when we expected to receive entry #107 with contents '2	Ni 008'
	solution_test.go:38: Channel was closed when we expected to receive entry #108 with contents '2	Ni 009'
	solution_test.go:38: Channel was closed when we expected to receive entry #109 with contents '2	Ni 010'
	solution_test.go:38: Channel was closed when we expected to receive entry #110 with contents '2	Ni 011'
	solution_test.go:38: Channel was closed when we expected to receive entry #111 with contents '2	Ni 012'
	solution_test.go:38: Channel was closed when we expected to receive entry #112 with contents '2	Ni 013'
	solution_test.go:38: Channel was closed when we expected to receive entry #113 with contents '2	Ni 014'
	solution_test.go:38: Channel was closed when we expected to receive entry #114 with contents '2	Ni 015'
	solution_test.go:38: Channel was closed when we expected to receive entry #115 with contents '2	Ni 016'
	solution_test.go:38: Channel was closed when we expected to receive entry #116 with contents '2	Ni 017'
	solution_test.go:38: Channel was closed when we expected to receive entry #117 with contents '2	Ni 018'
	solution_test.go:38: Channel was closed when we expected to receive entry #118 with contents '2	Ni 019'
	solution_test.go:38: Channel was closed when we expected to receive entry #119 with contents '2	Ni 020'
	solution_test.go:38: Channel was closed when we expected to receive entry #120 with contents '2	Ni 021'
	solution_test.go:38: Channel was closed when we expected to receive entry #121 with contents '2	Ni 022'
	solution_test.go:38: Channel was closed when we expected to receive entry #122 with contents '2	Ni 023'
	solution_test.go:38: Channel was closed when we expected to receive entry #123 with contents '2	Ni 024'
	solution_test.go:38: Channel was closed when we expected to receive entry #124 with contents '2	Ni 025'
	solution_test.go:38: Channel was closed when we expected to receive entry #125 with contents '2	Ni 026'
	solution_test.go:38: Channel was closed when we expected to receive entry #126 with contents '2	Ni 027'
	solution_test.go:38: Channel was closed when we expected to receive entry #127 with contents '2	Ni 028'
	solution_test.go:38: Channel was closed when we expected to receive entry #128 with contents '2	Ni 029'
	solution_test.go:38: Channel was closed when we expected to receive entry #129 with contents '2	Ni 030'
	solution_test.go:38: Channel was closed when we expected to receive entry #130 with contents '2	Ni 031'
	solution_test.go:38: Channel was closed when we expected to receive entry #131 with contents '2	Ni 032'
	solution_test.go:38: Channel was closed when we expected to receive entry #132 with contents '2	Ni 033'
	solution_test.go:38: Channel was closed when we expected to receive entry #133 with contents '2	Ni 034'
	solution_test.go:38: Channel was closed when we expected to receive entry #134 with contents '2	Ni 035'
	solution_test.go:38: Channel was closed when we expected to receive entry #135 with contents '2	Ni 036'
	solution_test.go:38: Channel was closed when we expected to receive entry #136 with contents '2	Ni 037'
	solution_test.go:38: Channel was closed when we expected to receive entry #137 with contents '2	Ni 038'
	solution_test.go:38: Channel was closed when we expected to receive entry #138 with contents '2	Ni 039'
	solution_test.go:38: Channel was closed when we expected to receive entry #139 with contents '2	Ni 040'
	solution_test.go:38: Channel was closed when we expected to receive entry #140 with contents '2	Ni 041'
	solution_test.go:38: Channel was closed when we expected to receive entry #141 with contents '2	Ni 042'
	solution_test.go:38: Channel was closed when we expected to receive entry #142 with contents '2	Ni 043'
	solution_test.go:38: Channel was closed when we expected to receive entry #143 with contents '2	Ni 044'
	solution_test.go:38: Channel was closed when we expected to receive entry #144 with contents '2	Ni 045'
	solution_test.go:38: Channel was closed when we expected to receive entry #145 with contents '2	Ni 046'
	solution_test.go:38: Channel was closed when we expected to receive entry #146 with contents '2	Ni 047'
	solution_test.go:38: Channel was closed when we expected to receive entry #147 with contents '2	Ni 048'
	solution_test.go:38: Channel was closed when we expected to receive entry #148 with contents '2	Ni 049'
	solution_test.go:38: Channel was closed when we expected to receive entry #149 with contents '2	Ni 050'
	solution_test.go:38: Channel was closed when we expected to receive entry #150 with contents '2	Ni 051'
	solution_test.go:38: Channel was closed when we expected to receive entry #151 with contents '2	Ni 052'
	solution_test.go:38: Channel was closed when we expected to receive entry #152 with contents '2	Ni 053'
	solution_test.go:38: Channel was closed when we expected to receive entry #153 with contents '2	Ni 054'
	solution_test.go:38: Channel was closed when we expected to receive entry #154 with contents '2	Ni 055'
	solution_test.go:38: Channel was closed when we expected to receive entry #155 with contents '2	Ni 056'
	solution_test.go:38: Channel was closed when we expected to receive entry #156 with contents '2	Ni 057'
	solution_test.go:38: Channel was closed when we expected to receive entry #157 with contents '2	Ni 058'
	solution_test.go:38: Channel was closed when we expected to receive entry #158 with contents '2	Ni 059'
	solution_test.go:38: Channel was closed when we expected to receive entry #159 with contents '2	Ni 060'
	solution_test.go:38: Channel was closed when we expected to receive entry #160 with contents '2	Ni 061'
	solution_test.go:38: Channel was closed when we expected to receive entry #161 with contents '2	Ni 062'
	solution_test.go:38: Channel was closed when we expected to receive entry #162 with contents '2	Ni 063'
	solution_test.go:38: Channel was closed when we expected to receive entry #163 with contents '2	Ni 064'
	solution_test.go:38: Channel was closed when we expected to receive entry #164 with contents '2	Ni 065'
	solution_test.go:38: Channel was closed when we expected to receive entry #165 with contents '2	Ni 066'
	solution_test.go:38: Channel was closed when we expected to receive entry #166 with contents '2	Ni 067'
	solution_test.go:38: Channel was closed when we expected to receive entry #167 with contents '2	Ni 068'
	solution_test.go:38: Channel was closed when we expected to receive entry #168 with contents '2	Ni 069'
	solution_test.go:38: Channel was closed when we expected to receive entry #169 with contents '2	Ni 070'
	solution_test.go:38: Channel was closed when we expected to receive entry #170 with contents '2	Ni 071'
	solution_test.go:38: Channel was closed when we expected to receive entry #171 with contents '2	Ni 072'
	solution_test.go:38: Channel was closed when we expected to receive entry #172 with contents '2	Ni 073'
	solution_test.go:38: Channel was closed when we expected to receive entry #173 with contents '2	Ni 074'
	solution_test.go:38: Channel was closed when we expected to receive entry #174 with contents '2	Ni 075'
	solution_test.go:38: Channel was closed when we expected to receive entry #175 with contents '2	Ni 076'
	solution_test.go:38: Channel was closed when we expected to receive entry #176 with contents '2	Ni 077'
	solution_test.go:38: Channel was closed when we expected to receive entry #177 with contents '2	Ni 078'
	solution_test.go:38: Channel was closed when we expected to receive entry #178 with contents '2	Ni 079'
	solution_test.go:38: Channel was closed when we expected to receive entry #179 with contents '2	Ni 080'
	solution_test.go:38: Channel was closed when we expected to receive entry #180 with contents '2	Ni 081'
	solution_test.go:38: Channel was closed when we expected to receive entry #181 with contents '2	Ni 082'
	solution_test.go:38: Channel was closed when we expected to receive entry #182 with contents '2	Ni 083'
	solution_test.go:38: Channel was closed when we expected to receive entry #183 with contents '2	Ni 084'
	solution_test.go:38: Channel was closed when we expected to receive entry #184 with contents '2	Ni 085'
	solution_test.go:38: Channel was closed when we expected to receive entry #185 with contents '2	Ni 086'
	solution_test.go:38: Channel was closed when we expected to receive entry #186 with contents '2	Ni 087'
	solution_test.go:38: Channel was closed when we expected to receive entry #187 with contents '2	Ni 088'
	solution_test.go:38: Channel was closed when we expected to receive entry #188 with contents '2	Ni 089'
	solution_test.go:38: Channel was closed when we expected to receive entry #189 with contents '2	Ni 090'
	solution_test.go:38: Channel was closed when we expected to receive entry #190 with contents '2	Ni 091'
	solution_test.go:38: Channel was closed when we expected to receive entry #191 with contents '2	Ni 092'
	solution_test.go:38: Channel was closed when we expected to receive entry #192 with contents '2	Ni 093'
	solution_test.go:38: Channel was closed when we expected to receive entry #193 with contents '2	Ni 094'
	solution_test.go:38: Channel was closed when we expected to receive entry #194 with contents '2	Ni 095'
	solution_test.go:38: Channel was closed when we expected to receive entry #195 with contents '2	Ni 096'
	solution_test.go:38: Channel was closed when we expected to receive entry #196 with contents '2	Ni 097'
	solution_test.go:38: Channel was closed when we expected to receive entry #197 with contents '2	Ni 098'
	solution_test.go:38: Channel was closed when we expected to receive entry #198 with contents '2	Ni 099'
	solution_test.go:38: Channel was closed when we expected to receive entry #199 with contents '2	Ni 100'
	solution_test.go:38: Channel was closed when we expected to receive entry #200 with contents '3	end!'
panic: send on closed channel

goroutine 18 [running]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 1 [runnable]:
syscall.Syscall(0x1, 0x1, 0xc820119300, 0x5221, 0x5221, 0x5221, 0x0)
	/usr/local/go/src/syscall/asm_linux_amd64.s:18 +0x5
syscall.write(0x1, 0xc820119300, 0x5221, 0x5300, 0xc82003f930, 0x0, 0x0)
	/usr/local/go/src/syscall/zsyscall_linux_amd64.go:1064 +0x5f
syscall.Write(0x1, 0xc820119300, 0x5221, 0x5300, 0x684a50, 0x0, 0x0)
	/usr/local/go/src/syscall/syscall_unix.go:176 +0x4d
os.(*File).write(0xc82002c010, 0xc820119300, 0x5221, 0x5300, 0x0, 0x0, 0x0)
	/usr/local/go/src/os/file_unix.go:232 +0xaa
os.(*File).Write(0xc82002c010, 0xc820119300, 0x5221, 0x5300, 0x4, 0x0, 0x0)
	/usr/local/go/src/os/file.go:139 +0x8a
fmt.Fprintf(0x7f00b6dc2028, 0xc82002c010, 0x5a8ef0, 0x12, 0xc82003fc08, 0x4, 0x4, 0x40c370, 0x0, 0x0)
	/usr/local/go/src/fmt/print.go:189 +0xb2
fmt.Printf(0x5a8ef0, 0x12, 0xc82003fc08, 0x4, 0x4, 0x2, 0x0, 0x0)
	/usr/local/go/src/fmt/print.go:197 +0x94
testing.(*T).report(0xc82008c000)
	/usr/local/go/src/testing/testing.go:512 +0x2ed
testing.RunTests(0x5d4918, 0x65eba0, 0x8, 0x8, 0x1)
	/usr/local/go/src/testing/testing.go:583 +0x585
testing.(*M).Run(0xc82003fef8, 0xc820010650)
	/usr/local/go/src/testing/testing.go:494 +0x70
main.main()
	_/tmp/d20151110-19113-emq47t/_test/_testmain.go:68 +0x116

goroutine 10 [chan receive]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:16 +0x5f
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 19 [runnable]:
_/tmp/d20151110-19113-emq47t.TestTheLimits.func1.1(0xc82001e420)
	/tmp/d20151110-19113-emq47t/solution_test.go:228
created by _/tmp/d20151110-19113-emq47t.TestTheLimits.func1
	/tmp/d20151110-19113-emq47t/solution_test.go:233 +0x205

goroutine 20 [runnable]:
_/tmp/d20151110-19113-emq47t.TestTheLimits.func1.2(0xc8200a0000)
	/tmp/d20151110-19113-emq47t/solution_test.go:234
created by _/tmp/d20151110-19113-emq47t.TestTheLimits.func1
	/tmp/d20151110-19113-emq47t/solution_test.go:239 +0x227
exit status 2
FAIL	_/tmp/d20151110-19113-emq47t	0.011s
panic: send on closed channel

goroutine 159 [running]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 1 [chan receive]:
testing.RunTests(0x5d4918, 0x65eba0, 0x8, 0x8, 0x1)
	/usr/local/go/src/testing/testing.go:582 +0x558
testing.(*M).Run(0xc82003fef8, 0xc820010650)
	/usr/local/go/src/testing/testing.go:494 +0x70
main.main()
	_/tmp/d20151110-19113-emq47t/_test/_testmain.go:68 +0x116

goroutine 6 [select]:
_/tmp/d20151110-19113-emq47t.withTimeout(0xc82008e000, 0x2faf0800, 0xc82001a1e0)
	/tmp/d20151110-19113-emq47t/solution_test.go:24 +0x262
_/tmp/d20151110-19113-emq47t.TestWithManyLogs(0xc82008e000)
	/tmp/d20151110-19113-emq47t/solution_test.go:272 +0x182
testing.tRunner(0xc82008e000, 0x65ec48)
	/usr/local/go/src/testing/testing.go:456 +0x98
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:561 +0x86d

goroutine 7 [chan receive]:
testing.RunTests.func1(0xc82001e120, 0xc82008e000)
	/usr/local/go/src/testing/testing.go:565 +0x47
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:566 +0x90e

goroutine 8 [chan receive]:
_/tmp/d20151110-19113-emq47t.TestWithManyLogs.func1()
	/tmp/d20151110-19113-emq47t/solution_test.go:271 +0x345
_/tmp/d20151110-19113-emq47t.withTimeout.func1(0xc82008e000, 0xc82001e300, 0xc82001a1e0)
	/tmp/d20151110-19113-emq47t/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-emq47t.withTimeout
	/tmp/d20151110-19113-emq47t/solution_test.go:22 +0x7c

goroutine 111 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 112 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 113 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 114 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 115 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 116 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 117 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 118 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 119 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 120 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 121 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 122 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 123 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 124 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 125 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 126 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 127 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 128 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 129 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 130 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 131 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 132 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 133 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 134 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 135 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 136 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 137 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 138 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 139 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 140 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 141 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 142 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 143 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 144 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 145 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 146 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 147 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 148 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 149 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 150 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 151 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 152 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 153 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 154 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 155 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 156 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 157 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 158 [runnable]:
_/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0xc820010710)
	/tmp/d20151110-19113-emq47t/solution.go:17 +0x12c
created by _/tmp/d20151110-19113-emq47t.OrderedLogDrainer.func1
	/tmp/d20151110-19113-emq47t/solution.go:22 +0xe1

goroutine 160 [runnable]:
_/tmp/d20151110-19113-emq47t.resultChecker.func1(0xc820090000, 0x96, 0x96, 0xc82001e3c0, 0xc82008e000, 0xc8200c9c80)
	/tmp/d20151110-19113-emq47t/solution_test.go:40 +0x62e
created by _/tmp/d20151110-19113-emq47t.resultChecker
	/tmp/d20151110-19113-emq47t/solution_test.go:48 +0x89
exit status 2
FAIL	_/tmp/d20151110-19113-emq47t	0.010s

История (2 версии и 0 коментара)

Стоян обнови решението на 10.11.2015 13:45 (преди над 2 години)

+package main
+
+import (
+ "fmt"
+ "strconv"
+)
+
+func OrderedLogDrainer(logs chan (chan string)) chan string {
+ result := make(chan string, 100)
+ go func(result chan string) {
+
+ chanIndex := 1
+ for val := range logs {
+
+ go func() {
+ for str := range val {
+ result <- strconv.Itoa(chanIndex) + "\t" + str
+
+ }
+
+ chanIndex++
+ }()
+
+ }
+
+ close(result)
+ }(result)
+
+ return result
+}
+
+func main() {
+
+ logs := make(chan (chan string))
+ orderedLog := OrderedLogDrainer(logs)
+
+ first := make(chan string)
+ logs <- first
+ second := make(chan string)
+ logs <- second
+
+ first <- "test message 1 in first"
+ second <- "test message 1 in second"
+ second <- "test message 2 in second"
+ first <- "test message 2 in first"
+ first <- "test message 3 in first"
+ // Print the first message now just because we can
+ fmt.Println(<-orderedLog)
+
+ third := make(chan string)
+ logs <- third
+
+ third <- "test message 1 in third"
+ first <- "test message 4 in first"
+ close(first)
+ second <- "test message 3 in second"
+ close(third)
+ close(logs)
+
+ second <- "test message 4 in second"
+ close(second)
+
+ // Print all the rest of the messages
+ for logEntry := range orderedLog {
+ fmt.Println(logEntry)
+ }
+}

Стоян обнови решението на 10.11.2015 13:46 (преди над 2 години)

package main
import (
"fmt"
"strconv"
)
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string, 100)
go func(result chan string) {
chanIndex := 1
for val := range logs {
go func() {
for str := range val {
result <- strconv.Itoa(chanIndex) + "\t" + str
}
chanIndex++
}()
}
close(result)
}(result)
return result
}
func main() {
logs := make(chan (chan string))
orderedLog := OrderedLogDrainer(logs)
first := make(chan string)
logs <- first
second := make(chan string)
logs <- second
first <- "test message 1 in first"
second <- "test message 1 in second"
second <- "test message 2 in second"
first <- "test message 2 in first"
first <- "test message 3 in first"
// Print the first message now just because we can
fmt.Println(<-orderedLog)
third := make(chan string)
logs <- third
third <- "test message 1 in third"
first <- "test message 4 in first"
close(first)
second <- "test message 3 in second"
close(third)
close(logs)
second <- "test message 4 in second"
close(second)
// Print all the rest of the messages
for logEntry := range orderedLog {
fmt.Println(logEntry)
}
-}
+}