Skip to content

Commit 387fa39

Browse files
chemidyhiranya911
authored andcommitted
add travis build for go versions 1.7.x -> 1.10.x (#98)
* add build for go version 1.6.x -> 1.10.x * fix 1.10 version * fix context to golang.org/x/net/context for go 1.6 compatibility * add race detector + go vet on build + build without failure on go unstable * add go16 et go17 file due to req.withcontext which is only go 1.7 * fix context package * update go16.go to remove WithContext * update bad import * remove unused func * finally use ctxhttp.Do with multiple build version * ignore integration package for install * fix go get command * put go 1.6.X in allow_failures dur to test failure * fix inversion of code * remove go 1.6 support * revert initial version with req.WithContext * fix travis to support go 1.10.x * nits
1 parent 0dd57f9 commit 387fa39

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

.travis.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
language: go
2+
3+
go:
4+
- 1.7.x
5+
- 1.8.x
6+
- 1.9.x
7+
- "1.10.x"
8+
- master
9+
10+
matrix:
11+
# Build OK if fails on unstable development versions of Go.
12+
allow_failures:
13+
- go: master
14+
# Don't wait for tests to finish on allow_failures.
15+
# Mark the build finished if tests pass on other versions of Go.
16+
fast_finish: true
17+
218
go_import_path: firebase.google.com/go
19+
320
before_install:
4-
- go get github.com/golang/lint/golint
21+
- go get github.com/golang/lint/golint # Golint requires Go 1.6 or later.
22+
23+
install:
24+
# Prior to golang 1.8, this can trigger an error for packages containing only tests.
25+
- go get -t -v $(go list ./... | grep -v integration)
26+
527
script:
628
- golint -set_exit_status $(go list ./...)
7-
- go test -v -test.short ./...
8-
29+
- go test -v -race -test.short ./... # Run tests with the race detector.
30+
- go vet -v ./... # Run Go static analyzer.

messaging/messaging_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package messaging
1616

1717
import (
18-
"context"
1918
"encoding/json"
2019
"io/ioutil"
2120
"net/http"
@@ -25,9 +24,9 @@ import (
2524
"testing"
2625
"time"
2726

28-
"google.golang.org/api/option"
29-
3027
"firebase.google.com/go/internal"
28+
"golang.org/x/net/context"
29+
"google.golang.org/api/option"
3130
)
3231

3332
const testMessageID = "projects/test-project/messages/msg_id"

snippets/auth.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
package snippets
1616

1717
import (
18-
"context"
1918
"log"
2019

2120
firebase "firebase.google.com/go"
2221
"firebase.google.com/go/auth"
23-
22+
"golang.org/x/net/context"
2423
"google.golang.org/api/iterator"
2524
)
2625

0 commit comments

Comments
 (0)