Решение на Concurrent Retry Executor от Радослав Георгиев

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

Към профила на Радослав Георгиев

Резултати

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

Код

package main
import (
"fmt"
)
func OrderedLogDrainer(logs chan (chan string)) chan string {
mergedLogs := make(chan string, 100)
go func() {
i := 1
for log := range logs {
go func(i int) {
for logEntry := range log {
mergedLogs <- fmt.Sprintf("%d\t%s", i, logEntry)
}
}(i)
i++
}
close(mergedLogs)
}()
return mergedLogs
}

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

panic: send on closed channel

goroutine 24 [running]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc820072038, 0xc820060360, 0x1)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

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-9byj73/_test/_testmain.go:68 +0x116

goroutine 20 [select]:
_/tmp/d20151110-19113-9byj73.withTimeout(0xc8200a2000, 0x1dcd6500, 0xc8200625a0)
	/tmp/d20151110-19113-9byj73/solution_test.go:24 +0x262
_/tmp/d20151110-19113-9byj73.TestWithOneMessage(0xc8200a2000)
	/tmp/d20151110-19113-9byj73/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 [chan receive]:
_/tmp/d20151110-19113-9byj73.TestWithOneMessage.func1()
	/tmp/d20151110-19113-9byj73/solution_test.go:63 +0x19d
_/tmp/d20151110-19113-9byj73.withTimeout.func1(0xc8200a2000, 0xc820060240, 0xc8200625a0)
	/tmp/d20151110-19113-9byj73/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-9byj73.withTimeout
	/tmp/d20151110-19113-9byj73/solution_test.go:22 +0x7c

goroutine 3 [runnable]:
_/tmp/d20151110-19113-9byj73.resultChecker.func1(0xc820010140, 0x1, 0x1, 0xc820060360, 0xc8200a2000, 0xc82001e060)
	/tmp/d20151110-19113-9byj73/solution_test.go:34
created by _/tmp/d20151110-19113-9byj73.resultChecker
	/tmp/d20151110-19113-9byj73/solution_test.go:48 +0x89
exit status 2
FAIL	_/tmp/d20151110-19113-9byj73	0.005s
panic: send on closed channel

goroutine 25 [running]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc820072038, 0xc820060360, 0x2)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

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-9byj73/_test/_testmain.go:68 +0x116

goroutine 20 [select]:
_/tmp/d20151110-19113-9byj73.withTimeout(0xc8200a0000, 0x1dcd6500, 0xc820066390)
	/tmp/d20151110-19113-9byj73/solution_test.go:24 +0x262
_/tmp/d20151110-19113-9byj73.TestWithExample1(0xc8200a0000)
	/tmp/d20151110-19113-9byj73/solution_test.go:109 +0xe0
testing.tRunner(0xc8200a0000, 0x65ebb8)
	/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 receive]:
_/tmp/d20151110-19113-9byj73.TestWithExample1.func1()
	/tmp/d20151110-19113-9byj73/solution_test.go:108 +0x3da
_/tmp/d20151110-19113-9byj73.withTimeout.func1(0xc8200a0000, 0xc820060240, 0xc820066390)
	/tmp/d20151110-19113-9byj73/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-9byj73.withTimeout
	/tmp/d20151110-19113-9byj73/solution_test.go:22 +0x7c

goroutine 27 [runnable]:
testing.(*common).log(0xc8200a0000, 0xc820058460, 0x6a)
	/usr/local/go/src/testing/testing.go:343 +0x111
testing.(*common).Errorf(0xc8200a0000, 0x5c4f00, 0x3d, 0xc820041f48, 0x3, 0x3)
	/usr/local/go/src/testing/testing.go:366 +0x75
_/tmp/d20151110-19113-9byj73.resultChecker.func1(0xc8200a0090, 0x9, 0x9, 0xc820060360, 0xc8200a0000, 0xc8200604e0)
	/tmp/d20151110-19113-9byj73/solution_test.go:40 +0x774
created by _/tmp/d20151110-19113-9byj73.resultChecker
	/tmp/d20151110-19113-9byj73/solution_test.go:48 +0x89
exit status 2
FAIL	_/tmp/d20151110-19113-9byj73	0.007s
panic: send on closed channel

goroutine 10 [running]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x1)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

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-9byj73/_test/_testmain.go:68 +0x116

goroutine 6 [select]:
_/tmp/d20151110-19113-9byj73.withTimeout(0xc82008c000, 0x1dcd6500, 0xc82000a480)
	/tmp/d20151110-19113-9byj73/solution_test.go:24 +0x262
_/tmp/d20151110-19113-9byj73.TestWithExample2(0xc82008c000)
	/tmp/d20151110-19113-9byj73/solution_test.go:138 +0x11e
testing.tRunner(0xc82008c000, 0x65ebd0)
	/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 [runnable]:
_/tmp/d20151110-19113-9byj73.TestWithExample2.func1()
	/tmp/d20151110-19113-9byj73/solution_test.go:132 +0x177
_/tmp/d20151110-19113-9byj73.withTimeout.func1(0xc82008c000, 0xc82001e2a0, 0xc82000a480)
	/tmp/d20151110-19113-9byj73/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-9byj73.withTimeout
	/tmp/d20151110-19113-9byj73/solution_test.go:22 +0x7c

goroutine 17 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x2)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x139
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9
exit status 2
FAIL	_/tmp/d20151110-19113-9byj73	0.006s
PASS
ok  	_/tmp/d20151110-19113-9byj73	0.003s
--- FAIL: TestWithTwoEmptyLogs (0.00s)
	solution_test.go:40: Received log entry #0 with contents '2	bbb' when expecting '3	aaa'
	solution_test.go:40: Received log entry #1 with contents '3	aaa' when expecting '3	bbb'
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-9byj73	0.003s
panic: send on closed channel

goroutine 13 [running]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x2)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

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-9byj73/_test/_testmain.go:68 +0x116

goroutine 6 [select]:
_/tmp/d20151110-19113-9byj73.withTimeout(0xc82009c000, 0x35a4e900, 0xc820010700)
	/tmp/d20151110-19113-9byj73/solution_test.go:24 +0x262
_/tmp/d20151110-19113-9byj73.TestWithDelays(0xc82009c000)
	/tmp/d20151110-19113-9byj73/solution_test.go:206 +0x77
testing.tRunner(0xc82009c000, 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, 0xc82009c000)
	/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-9byj73.TestWithDelays.func1()
	/tmp/d20151110-19113-9byj73/solution_test.go:199 +0x210
_/tmp/d20151110-19113-9byj73.withTimeout.func1(0xc82009c000, 0xc82001e2a0, 0xc820010700)
	/tmp/d20151110-19113-9byj73/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-9byj73.withTimeout
	/tmp/d20151110-19113-9byj73/solution_test.go:22 +0x7c

goroutine 12 [chan receive]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x1)
	/tmp/d20151110-19113-9byj73/solution.go:15 +0x81
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9
exit status 2
FAIL	_/tmp/d20151110-19113-9byj73	0.706s
panic: send on closed channel

goroutine 10 [running]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x1)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

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-9byj73/_test/_testmain.go:68 +0x116

goroutine 6 [select]:
_/tmp/d20151110-19113-9byj73.withTimeout(0xc82008e000, 0x1dcd6500, 0xc82000a480)
	/tmp/d20151110-19113-9byj73/solution_test.go:24 +0x262
_/tmp/d20151110-19113-9byj73.TestTheLimits(0xc82008e000)
	/tmp/d20151110-19113-9byj73/solution_test.go:245 +0xf1
testing.tRunner(0xc82008e000, 0x65ec30)
	/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 [runnable]:
fmt.(*pp).fmtInt64(0xc8200a6000, 0x1, 0xc800000064)
	/usr/local/go/src/fmt/print.go:361
fmt.(*pp).printArg(0xc8200a6000, 0x5255a0, 0xc8200a42b0, 0x64, 0x0, 0x0)
	/usr/local/go/src/fmt/print.go:775 +0xf32
fmt.(*pp).doPrintf(0xc8200a6000, 0x58f0e0, 0xb, 0xc820040f48, 0x2, 0x2)
	/usr/local/go/src/fmt/print.go:1219 +0x1dd8
fmt.Sprintf(0x58f0e0, 0xb, 0xc820040f48, 0x2, 0x2, 0x0, 0x0)
	/usr/local/go/src/fmt/print.go:203 +0x6f
_/tmp/d20151110-19113-9byj73.TestTheLimits.func1()
	/tmp/d20151110-19113-9byj73/solution_test.go:241 +0x3f0
_/tmp/d20151110-19113-9byj73.withTimeout.func1(0xc82008e000, 0xc82001e2a0, 0xc82000a480)
	/tmp/d20151110-19113-9byj73/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-9byj73.withTimeout
	/tmp/d20151110-19113-9byj73/solution_test.go:22 +0x7c

goroutine 19 [chan send]:
_/tmp/d20151110-19113-9byj73.TestTheLimits.func1.1(0xc82001e420)
	/tmp/d20151110-19113-9byj73/solution_test.go:230 +0x146
created by _/tmp/d20151110-19113-9byj73.TestTheLimits.func1
	/tmp/d20151110-19113-9byj73/solution_test.go:233 +0x205

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

goroutine 170 [running]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x96)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

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-9byj73/_test/_testmain.go:68 +0x116

goroutine 6 [select]:
_/tmp/d20151110-19113-9byj73.withTimeout(0xc82008c000, 0x2faf0800, 0xc82001a1e0)
	/tmp/d20151110-19113-9byj73/solution_test.go:24 +0x262
_/tmp/d20151110-19113-9byj73.TestWithManyLogs(0xc82008c000)
	/tmp/d20151110-19113-9byj73/solution_test.go:272 +0x182
testing.tRunner(0xc82008c000, 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, 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 receive]:
_/tmp/d20151110-19113-9byj73.TestWithManyLogs.func1()
	/tmp/d20151110-19113-9byj73/solution_test.go:271 +0x345
_/tmp/d20151110-19113-9byj73.withTimeout.func1(0xc82008c000, 0xc82001e300, 0xc82001a1e0)
	/tmp/d20151110-19113-9byj73/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-9byj73.withTimeout
	/tmp/d20151110-19113-9byj73/solution_test.go:22 +0x7c

goroutine 105 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x65)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 107 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x67)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 108 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x68)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 109 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x69)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 110 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x6a)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 111 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x6b)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 112 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x6c)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 129 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x6d)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 130 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x6e)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 118 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x6f)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 119 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x70)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 120 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x71)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 121 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x72)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 122 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x73)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 123 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x74)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 124 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x75)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 125 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x76)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 126 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x77)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 131 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x78)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 132 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x79)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 133 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x7a)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 134 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x7b)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 135 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x7c)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 136 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x7d)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 137 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x7e)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 138 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x7f)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 139 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x80)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 140 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x81)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 141 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x82)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 142 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x83)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 143 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x84)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 144 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x85)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 145 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x86)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 146 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x87)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 147 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x88)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 148 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x89)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 149 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x8a)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 127 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x8b)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 128 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x8c)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 161 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x8d)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 162 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x8e)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 163 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x8f)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 164 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x90)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 165 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x91)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 166 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x92)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 167 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x93)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 168 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x94)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 169 [runnable]:
_/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1.1(0xc82002c040, 0xc82001e3c0, 0x95)
	/tmp/d20151110-19113-9byj73/solution.go:16 +0x241
created by _/tmp/d20151110-19113-9byj73.OrderedLogDrainer.func1
	/tmp/d20151110-19113-9byj73/solution.go:18 +0xc9

goroutine 171 [runnable]:
sync.(*RWMutex).Unlock(0xc82008c000)
	/usr/local/go/src/sync/rwmutex.go:102
testing.(*common).log(0xc82008c000, 0xc82001a460, 0x44)
	/usr/local/go/src/testing/testing.go:344 +0x192
testing.(*common).Errorf(0xc82008c000, 0x5c4f00, 0x3d, 0xc820157f48, 0x3, 0x3)
	/usr/local/go/src/testing/testing.go:366 +0x75
_/tmp/d20151110-19113-9byj73.resultChecker.func1(0xc82008e000, 0x96, 0x96, 0xc82001e3c0, 0xc82008c000, 0xc82001fc80)
	/tmp/d20151110-19113-9byj73/solution_test.go:40 +0x774
created by _/tmp/d20151110-19113-9byj73.resultChecker
	/tmp/d20151110-19113-9byj73/solution_test.go:48 +0x89
exit status 2
FAIL	_/tmp/d20151110-19113-9byj73	0.012s

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

Радослав обнови решението на 10.11.2015 14:57 (преди над 2 години)

+package main
+
+import (
+ "fmt"
+)
+
+func OrderedLogDrainer(logs chan (chan string)) chan string {
+ mergedLogs := make(chan string, 100)
+
+ go func() {
+ i := 1
+
+ for log := range logs {
+ go func(i int) {
+ for logEntry := range log {
+ mergedLogs <- fmt.Sprintf("%d\t%s", i, logEntry)
+ }
+ }(i)
+
+ i++
+ }
+
+ close(mergedLogs)
+ }()
+
+ return mergedLogs
+}