From 5fb94172f40023670f9b65a617cdc3496062080c Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Wed, 22 Aug 2018 14:10:37 -0700 Subject: [PATCH] drop Go versions prior to 1.7 in CI * drop Go versions prior to 1.7 in CI * consolidate conn*.go files after dropping old Go support --- .travis.yml | 3 --- conn.go | 9 +++++++++ conn_read.go | 18 ------------------ conn_read_legacy.go | 21 --------------------- 4 files changed, 9 insertions(+), 42 deletions(-) delete mode 100644 conn_read.go delete mode 100644 conn_read_legacy.go diff --git a/.travis.yml b/.travis.yml index 1f73047..a880cd9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,6 @@ sudo: false matrix: include: - - go: 1.4 - - go: 1.5.x - - go: 1.6.x - go: 1.7.x - go: 1.8.x - go: 1.9.x diff --git a/conn.go b/conn.go index 5f46bf4..78f972b 100644 --- a/conn.go +++ b/conn.go @@ -370,6 +370,15 @@ func (c *Conn) writeFatal(err error) error { return err } +func (c *Conn) read(n int) ([]byte, error) { + p, err := c.br.Peek(n) + if err == io.EOF { + err = errUnexpectedEOF + } + c.br.Discard(len(p)) + return p, err +} + func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error { <-c.mu defer func() { c.mu <- true }() diff --git a/conn_read.go b/conn_read.go deleted file mode 100644 index 1ea1505..0000000 --- a/conn_read.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.5 - -package websocket - -import "io" - -func (c *Conn) read(n int) ([]byte, error) { - p, err := c.br.Peek(n) - if err == io.EOF { - err = errUnexpectedEOF - } - c.br.Discard(len(p)) - return p, err -} diff --git a/conn_read_legacy.go b/conn_read_legacy.go deleted file mode 100644 index 018541c..0000000 --- a/conn_read_legacy.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.5 - -package websocket - -import "io" - -func (c *Conn) read(n int) ([]byte, error) { - p, err := c.br.Peek(n) - if err == io.EOF { - err = errUnexpectedEOF - } - if len(p) > 0 { - // advance over the bytes just read - io.ReadFull(c.br, p) - } - return p, err -}