From 2097509d169c919a1529cbbeaafe080a26d36aa8 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Date: Sat, 6 Aug 2016 14:30:03 +0200 Subject: [PATCH] fix go vet warning --- ackhandler/sent_packet_handler_test.go | 8 +++--- ackhandlerlegacy/sent_packet_handler_test.go | 12 ++++---- h2quic/request_test.go | 30 ++++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ackhandler/sent_packet_handler_test.go b/ackhandler/sent_packet_handler_test.go index 1faef4009..9f1484114 100644 --- a/ackhandler/sent_packet_handler_test.go +++ b/ackhandler/sent_packet_handler_test.go @@ -677,7 +677,7 @@ var _ = Describe("SentPacketHandler", func() { // rttUpdated, bytesInFlight, ackedPackets, lostPackets Expect(cong.argsOnCongestionEvent[0]).To(BeTrue()) Expect(cong.argsOnCongestionEvent[1]).To(Equal(protocol.ByteCount(2))) - Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{1, 1}, {3, 3}})) + Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{Number: 1, Length: 1}, {Number: 3, Length: 3}})) Expect(cong.argsOnCongestionEvent[3]).To(BeEmpty()) // Loose the packet @@ -697,8 +697,8 @@ var _ = Describe("SentPacketHandler", func() { Expect(err).NotTo(HaveOccurred()) } - Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{packetNumber, protocol.ByteCount(packetNumber)}})) - Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{2, 2}})) + Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{Number: packetNumber, Length: protocol.ByteCount(packetNumber)}})) + Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{Number: 2, Length: 2}})) }) It("allows or denies sending", func() { @@ -718,7 +718,7 @@ var _ = Describe("SentPacketHandler", func() { Expect(cong.argsOnCongestionEvent[0]).To(BeFalse()) Expect(cong.argsOnCongestionEvent[1]).To(Equal(protocol.ByteCount(1))) Expect(cong.argsOnCongestionEvent[2]).To(BeEmpty()) - Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{1, 1}})) + Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{Number: 1, Length: 1}})) Expect(cong.onRetransmissionTimeout).To(BeTrue()) }) }) diff --git a/ackhandlerlegacy/sent_packet_handler_test.go b/ackhandlerlegacy/sent_packet_handler_test.go index 78e0ea4c0..a7284bbdd 100644 --- a/ackhandlerlegacy/sent_packet_handler_test.go +++ b/ackhandlerlegacy/sent_packet_handler_test.go @@ -673,7 +673,7 @@ var _ = Describe("SentPacketHandler", func() { handler.SentPacket(&Packet{PacketNumber: 3, Frames: []frames.Frame{}, Length: 3}) ack := frames.AckFrameLegacy{ LargestObserved: 3, - NackRanges: []frames.NackRange{{2, 2}}, + NackRanges: []frames.NackRange{{FirstPacketNumber: 2, LastPacketNumber: 2}}, } err := handler.ReceivedAck(&frames.AckFrame{AckFrameLegacy: &ack}, 1) Expect(err).NotTo(HaveOccurred()) @@ -681,7 +681,7 @@ var _ = Describe("SentPacketHandler", func() { // rttUpdated, bytesInFlight, ackedPackets, lostPackets Expect(cong.argsOnCongestionEvent[0]).To(BeTrue()) Expect(cong.argsOnCongestionEvent[1]).To(Equal(protocol.ByteCount(2))) - Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{1, 1}, {3, 3}})) + Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{Number: 1, Length: 1}, {Number: 3, Length: 3}})) Expect(cong.argsOnCongestionEvent[3]).To(BeEmpty()) // Loose the packet @@ -691,14 +691,14 @@ var _ = Describe("SentPacketHandler", func() { handler.SentPacket(&Packet{PacketNumber: packetNumber, Frames: []frames.Frame{}, Length: protocol.ByteCount(packetNumber)}) ack := frames.AckFrameLegacy{ LargestObserved: packetNumber, - NackRanges: []frames.NackRange{{2, 2}}, + NackRanges: []frames.NackRange{{FirstPacketNumber: 2, LastPacketNumber: 2}}, } err = handler.ReceivedAck(&frames.AckFrame{AckFrameLegacy: &ack}, protocol.PacketNumber(2+i)) Expect(err).NotTo(HaveOccurred()) } - Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{packetNumber, protocol.ByteCount(packetNumber)}})) - Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{2, 2}})) + Expect(cong.argsOnCongestionEvent[2]).To(Equal(congestion.PacketVector{{Number: packetNumber, Length: protocol.ByteCount(packetNumber)}})) + Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{Number: 2, Length: 2}})) }) It("allows or denies sending", func() { @@ -718,7 +718,7 @@ var _ = Describe("SentPacketHandler", func() { Expect(cong.argsOnCongestionEvent[0]).To(BeFalse()) Expect(cong.argsOnCongestionEvent[1]).To(Equal(protocol.ByteCount(1))) Expect(cong.argsOnCongestionEvent[2]).To(BeEmpty()) - Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{1, 1}})) + Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{Number: 1, Length: 1}})) Expect(cong.onRetransmissionTimeout).To(BeTrue()) }) diff --git a/h2quic/request_test.go b/h2quic/request_test.go index 08f42b069..2f18ca0fc 100644 --- a/h2quic/request_test.go +++ b/h2quic/request_test.go @@ -12,9 +12,9 @@ import ( var _ = Describe("Request", func() { It("populates request", func() { headers := []hpack.HeaderField{ - {":path", "/foo", false}, - {":authority", "quic.clemente.io", false}, - {":method", "GET", false}, + {Name: ":path", Value: "/foo"}, + {Name: ":authority", Value: "quic.clemente.io"}, + {Name: ":method", Value: "GET"}, } req, err := requestFromHeaders(headers) Expect(err).NotTo(HaveOccurred()) @@ -31,12 +31,12 @@ var _ = Describe("Request", func() { It("handles other headers", func() { headers := []hpack.HeaderField{ - {":path", "/foo", false}, - {":authority", "quic.clemente.io", false}, - {":method", "GET", false}, - {"content-length", "42", false}, - {"duplicate-header", "1", false}, - {"duplicate-header", "2", false}, + {Name: ":path", Value: "/foo"}, + {Name: ":authority", Value: "quic.clemente.io"}, + {Name: ":method", Value: "GET"}, + {Name: "content-length", Value: "42"}, + {Name: "duplicate-header", Value: "1"}, + {Name: "duplicate-header", Value: "2"}, } req, err := requestFromHeaders(headers) Expect(err).NotTo(HaveOccurred()) @@ -48,8 +48,8 @@ var _ = Describe("Request", func() { It("errors with missing path", func() { headers := []hpack.HeaderField{ - {":authority", "quic.clemente.io", false}, - {":method", "GET", false}, + {Name: ":authority", Value: "quic.clemente.io"}, + {Name: ":method", Value: "GET"}, } _, err := requestFromHeaders(headers) Expect(err).To(MatchError(":path, :authority and :method must not be empty")) @@ -57,8 +57,8 @@ var _ = Describe("Request", func() { It("errors with missing method", func() { headers := []hpack.HeaderField{ - {":path", "/foo", false}, - {":authority", "quic.clemente.io", false}, + {Name: ":path", Value: "/foo"}, + {Name: ":authority", Value: "quic.clemente.io"}, } _, err := requestFromHeaders(headers) Expect(err).To(MatchError(":path, :authority and :method must not be empty")) @@ -66,8 +66,8 @@ var _ = Describe("Request", func() { It("errors with missing authority", func() { headers := []hpack.HeaderField{ - {":path", "/foo", false}, - {":method", "GET", false}, + {Name: ":path", Value: "/foo"}, + {Name: ":method", Value: "GET"}, } _, err := requestFromHeaders(headers) Expect(err).To(MatchError(":path, :authority and :method must not be empty"))