run staticcheck in gometalinter

This commit is contained in:
Marten Seemann 2018-02-21 22:52:36 +08:00
parent b6470311ea
commit 286a51bcc0
6 changed files with 5 additions and 19 deletions

View file

@ -10,6 +10,7 @@
"goimports", "goimports",
"ineffassign", "ineffassign",
"misspell", "misspell",
"staticcheck",
"structcheck", "structcheck",
"unconvert", "unconvert",
"unused", "unused",

View file

@ -6,7 +6,7 @@ go get -t ./...
if [ ${TESTMODE} == "lint" ]; then if [ ${TESTMODE} == "lint" ]; then
go get github.com/alecthomas/gometalinter go get github.com/alecthomas/gometalinter
gometalinter --install gometalinter --install
gometalinter --tests ./... gometalinter --deadline=90s --tests ./...
fi fi
if [ ${TESTMODE} == "unit" ]; then if [ ${TESTMODE} == "unit" ]; then

View file

@ -33,16 +33,7 @@ func responseFromHeaders(f *http2.MetaHeadersFrame) (*http.Response, error) {
return nil, errors.New("malformed non-numeric status pseudo header") return nil, errors.New("malformed non-numeric status pseudo header")
} }
if statusCode == 100 { // TODO: handle statusCode == 100
// TODO: handle this
// traceGot100Continue(cs.trace)
// if cs.on100 != nil {
// cs.on100() // forces any write delay timer to fire
// }
// cs.pastHeaders = false // do it all again
// return nil, nil
}
header := make(http.Header) header := make(http.Header)
res := &http.Response{ res := &http.Response{
@ -78,13 +69,7 @@ func setLength(res *http.Response, isHead, streamEnded bool) *http.Response {
if clens := res.Header["Content-Length"]; len(clens) == 1 { if clens := res.Header["Content-Length"]; len(clens) == 1 {
if clen64, err := strconv.ParseInt(clens[0], 10, 64); err == nil { if clen64, err := strconv.ParseInt(clens[0], 10, 64); err == nil {
res.ContentLength = clen64 res.ContentLength = clen64
} else {
// TODO: care? unlike http/1, it won't mess up our framing, so it's
// more safe smuggling-wise to ignore.
} }
} else if len(clens) > 1 {
// TODO: care? unlike http/1, it won't mess up our framing, so it's
// more safe smuggling-wise to ignore.
} }
} }
return res return res

View file

@ -110,7 +110,6 @@ var _ = Describe("Connection Flow controller", func() {
) )
BeforeEach(func() { BeforeEach(func() {
controller.bytesRead = receiveWindowSize - receiveWindowSize
controller.receiveWindow = receiveWindow controller.receiveWindow = receiveWindow
controller.receiveWindowSize = receiveWindowSize controller.receiveWindowSize = receiveWindowSize
oldWindowSize = controller.receiveWindowSize oldWindowSize = controller.receiveWindowSize

View file

@ -589,8 +589,8 @@ var _ = Describe("Server", func() {
conn.dataToRead <- b.Bytes() conn.dataToRead <- b.Bytes()
conn.dataReadFrom = udpAddr conn.dataReadFrom = udpAddr
ln, err := Listen(conn, testdata.GetTLSConfig(), config) ln, err := Listen(conn, testdata.GetTLSConfig(), config)
defer ln.Close()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
defer ln.Close()
Consistently(func() int { return conn.dataWritten.Len() }).Should(BeZero()) Consistently(func() int { return conn.dataWritten.Len() }).Should(BeZero())
}) })

View file

@ -72,6 +72,7 @@ var _ = Describe("Streams Map (for gQUIC)", func() {
It("gets existing streams", func() { It("gets existing streams", func() {
s, err := m.getOrOpenStream(5) s, err := m.getOrOpenStream(5)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(s.StreamID()).To(Equal(protocol.StreamID(5)))
numStreams := m.numIncomingStreams numStreams := m.numIncomingStreams
s, err = m.getOrOpenStream(5) s, err = m.getOrOpenStream(5)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())