Proposing some changes in the library, to correct some behaviour seen in Go1.8
When we started using the library with Go1.8, the contentTransfer() and Total() methods returned out of order values. So we propose to simplify the internals of the struct Result, depend only on the End() method.
Also some test were added to test for Client that has a very simple Transport, no Dialer nor DialerContext, and running in go 1.8. This was our case and it was better to have it tested here.
The tests are passing:
go test -v -parallel=4 github.com/tcnksm/go-httpstat
=== RUN TestHTTPStat_HTTPS
DNSDone
tcpDone
tlsDone
GotConn
serverStart
--- PASS: TestHTTPStat_HTTPS (0.71s)
=== RUN TestHTTPStat_HTTP
DNSDone
tcpDone
GotConn
serverStart
--- PASS: TestHTTPStat_HTTP (0.02s)
=== RUN TestHTTPStat_KeepAlive_HTTPS
GotConn >>>> Only cached connection prints
serverStart >>>> Only cached connection prints
--- PASS: TestHTTPStat_KeepAlive_HTTPS (1.17s)
=== RUN TestHTTPStat_KeepAlive_HTTP
GotConn >>>> Only cached connection prints
serverStart >>>> Only cached connection prints
--- PASS: TestHTTPStat_KeepAlive_HTTP (0.02s)
=== RUN TestHTTPStat_beforeGO17
tlsDone >>>> No DNS nor TCP stages
GotConn
serverStart
GotConn >>>> Cached connetion
serverStart
--- PASS: TestHTTPStat_beforeGO17 (0.40s)
=== RUN TestHTTPStat_NoDialer_HTTPS
DNSDone
tcpDone
tlsDone
GotConn
serverStart
GotConn >>>> Cached connetion
serverStart >>>> Cached connetion
--- PASS: TestHTTPStat_NoDialer_HTTPS (1.25s)
=== RUN TestHTTPStat_NoDialer_HTTP
DNSDone
tcpDone
GotConn
serverStart
GotConn >>>> Cached connetion
serverStart >>>> Cached connetion
--- PASS: TestHTTPStat_NoDialer_HTTP (0.02s)
=== RUN TestTotal_Zero
--- PASS: TestTotal_Zero (0.00s)
=== RUN TestHTTPStat_Formatter
--- PASS: TestHTTPStat_Formatter (0.00s)
PASS
ok github.com/tcnksm/go-httpstat 3.593s
Proposing some changes in the library, to correct some behaviour seen in Go1.8
When we started using the library with Go1.8, the contentTransfer() and Total() methods returned out of order values. So we propose to simplify the internals of the struct Result, depend only on the End() method.
Also some test were added to test for Client that has a very simple Transport, no Dialer nor DialerContext, and running in go 1.8. This was our case and it was better to have it tested here.
The tests are passing:
go test -v -parallel=4 github.com/tcnksm/go-httpstat === RUN TestHTTPStat_HTTPS DNSDone tcpDone tlsDone GotConn serverStart --- PASS: TestHTTPStat_HTTPS (0.71s) === RUN TestHTTPStat_HTTP DNSDone tcpDone GotConn serverStart --- PASS: TestHTTPStat_HTTP (0.02s) === RUN TestHTTPStat_KeepAlive_HTTPS GotConn >>>> Only cached connection prints serverStart >>>> Only cached connection prints --- PASS: TestHTTPStat_KeepAlive_HTTPS (1.17s) === RUN TestHTTPStat_KeepAlive_HTTP GotConn >>>> Only cached connection prints serverStart >>>> Only cached connection prints --- PASS: TestHTTPStat_KeepAlive_HTTP (0.02s) === RUN TestHTTPStat_beforeGO17 tlsDone >>>> No DNS nor TCP stages GotConn serverStart GotConn >>>> Cached connetion serverStart --- PASS: TestHTTPStat_beforeGO17 (0.40s) === RUN TestHTTPStat_NoDialer_HTTPS DNSDone tcpDone tlsDone GotConn serverStart GotConn >>>> Cached connetion serverStart >>>> Cached connetion --- PASS: TestHTTPStat_NoDialer_HTTPS (1.25s) === RUN TestHTTPStat_NoDialer_HTTP DNSDone tcpDone GotConn serverStart GotConn >>>> Cached connetion serverStart >>>> Cached connetion --- PASS: TestHTTPStat_NoDialer_HTTP (0.02s) === RUN TestTotal_Zero --- PASS: TestTotal_Zero (0.00s) === RUN TestHTTPStat_Formatter --- PASS: TestHTTPStat_Formatter (0.00s) PASS ok github.com/tcnksm/go-httpstat 3.593s