fix go vet warning

This commit is contained in:
Lucas Clemente
2016-08-06 14:30:03 +02:00
parent 100f04f242
commit 2097509d16
3 changed files with 25 additions and 25 deletions

View File

@@ -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())
})
})

View File

@@ -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())
})

View File

@@ -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"))