From 593076f015ffcf6f3d0ea6a5bf50ddffce377f84 Mon Sep 17 00:00:00 2001 From: Matt Silverlock Date: Thu, 27 Jun 2019 13:27:15 -0700 Subject: [PATCH 1/4] Create config.yml --- .circleci/config.yml | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..3b903aff --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,65 @@ +version: 2.0 + +jobs: + # Base test configuration for Go library tests Each distinct version should + # inherit this base, and override (at least) the container image used. + "test": &test + docker: + - image: circleci/golang:latest + working_directory: /go/src/github.com/gorilla/websocket + steps: &steps + - checkout + - run: go version + - run: go get -t -v ./... + - run: diff -u <(echo -n) <(gofmt -d .) + - run: if [[ "$LATEST" = true ]]; then go vet -v .; fi + - run: go test -v -race ./... + + "latest": + <<: *test + environment: + LATEST: true + + + "1.12": + <<: *test + docker: + - image: circleci/golang:1.12 + + "1.11": + <<: *test + docker: + - image: circleci/golang:1.11 + + "1.10": + <<: *test + docker: + - image: circleci/golang:1.10 + + "1.9": + <<: *test + docker: + - image: circleci/golang:1.9 + + "1.8": + <<: *test + docker: + - image: circleci/golang:1.8 + + "1.7": + <<: *test + docker: + - image: circleci/golang:1.7 + + +workflows: + version: 2 + build: + jobs: + - "latest" + - "1.12" + - "1.11" + - "1.10" + - "1.9" + - "1.8" + - "1.7" From 09231a70b6f4ff9f11267d16fd6ae7ac508bfe79 Mon Sep 17 00:00:00 2001 From: Matt Silverlock Date: Thu, 27 Jun 2019 13:29:34 -0700 Subject: [PATCH 2/4] Delete .travis.yml --- .travis.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a49db51c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: go -sudo: false - -matrix: - include: - - go: 1.7.x - - go: 1.8.x - - go: 1.9.x - - go: 1.10.x - - go: 1.11.x - - go: tip - allow_failures: - - go: tip - -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d .) - - go vet $(go list ./... | grep -v /vendor/) - - go test -v -race ./... From f80869a68ead858b355690c8cc6506fb2090b9e9 Mon Sep 17 00:00:00 2001 From: Matt Silverlock Date: Thu, 27 Jun 2019 13:31:05 -0700 Subject: [PATCH 3/4] Added CircleCI badge to README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f26fd466..0827d059 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Gorilla WebSocket +[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) +[![CircleCI](https://circleci.com/gh/gorilla/websocket.svg?style=svg)](https://circleci.com/gh/gorilla/websocket) + Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. -[![Build Status](https://travis-ci.org/gorilla/websocket.svg?branch=master)](https://travis-ci.org/gorilla/websocket) -[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) - ### Documentation * [API Reference](http://godoc.org/github.com/gorilla/websocket) From 895543b6c25d4a79f9723b348d3fad5f990e78c2 Mon Sep 17 00:00:00 2001 From: Matt Silverlock Date: Sat, 29 Jun 2019 02:51:08 -0700 Subject: [PATCH 4/4] Add golint; run on latest only --- .circleci/config.yml | 17 ++++++++++++++--- conn_test.go | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3b903aff..1240d78f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,20 @@ jobs: - checkout - run: go version - run: go get -t -v ./... - - run: diff -u <(echo -n) <(gofmt -d .) + # Only run gofmt, vet & lint against the latest Go version + - run: > + if [[ "$LATEST" = true ]]; then + go get -u golang.org/x/lint/golint + golint ./... + fi + - run: > + if [[ "$LATEST" = true ]]; then + diff -u <(echo -n) <(gofmt -d .) + fi + - run: > + if [[ "$LATEST" = true ]]; then + go vet -v . + fi - run: if [[ "$LATEST" = true ]]; then go vet -v .; fi - run: go test -v -race ./... @@ -20,7 +33,6 @@ jobs: environment: LATEST: true - "1.12": <<: *test docker: @@ -51,7 +63,6 @@ jobs: docker: - image: circleci/golang:1.7 - workflows: version: 2 build: diff --git a/conn_test.go b/conn_test.go index ad906b14..84937767 100644 --- a/conn_test.go +++ b/conn_test.go @@ -297,7 +297,7 @@ func TestWriteBufferPoolSync(t *testing.T) { // errorWriter is an io.Writer than returns an error on all writes. type errorWriter struct{} -func (ew errorWriter) Write(p []byte) (int, error) { return 0, errors.New("Error!") } +func (ew errorWriter) Write(p []byte) (int, error) { return 0, errors.New("error") } // TestWriteBufferPoolError ensures that buffer is returned to pool after error // on write.