Skip to content

Commit 1cbe2fe

Browse files
authored
Go1.11 travis (#345)
* add go 1.11.x to travis ci * fix test vet warnings * update example formatting with new goimports
1 parent 44932d2 commit 1cbe2fe

3 files changed

Lines changed: 26 additions & 18 deletions

File tree

‎.travis.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ go:
44
- 1.7.x
55
- 1.8.x
66
- 1.9.x
7+
- 1.10.x
8+
- 1.11.x
79

810
install:
911
- go get -u golang.org/x/tools/cmd/goimports
@@ -15,4 +17,8 @@ script:
1517
- golint ./...
1618
- go test ./...
1719
- >
18-
goimports -d -e ./ | grep '.*' && { echo; echo "Aborting due to non-empty goimports output."; exit 1; } || :
20+
go_version=$(go version);
21+
if [ ${go_version:13:4} = "1.11" ]; then
22+
goimports -d -e ./ | grep '.*' && { echo; echo "Aborting due to non-empty goimports output."; exit 1; } || :;
23+
fi
24+

‎_examples/versions/main.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ func listArticles(w http.ResponseWriter, r *http.Request) {
7979
go func() {
8080
for i := 1; i <= 10; i++ {
8181
article := &data.Article{
82-
ID: i,
83-
Title: fmt.Sprintf("Article #%v", i),
84-
Data: []string{"one", "two", "three", "four"},
82+
ID: i,
83+
Title: fmt.Sprintf("Article #%v", i),
84+
Data: []string{"one", "two", "three", "four"},
8585
CustomDataForAuthUsers: "secret data for auth'd users only",
8686
}
8787

@@ -111,9 +111,9 @@ func getArticle(w http.ResponseWriter, r *http.Request) {
111111
return
112112
}
113113
article := &data.Article{
114-
ID: 1,
115-
Title: "Article #1",
116-
Data: []string{"one", "two", "three", "four"},
114+
ID: 1,
115+
Title: "Article #1",
116+
Data: []string{"one", "two", "three", "four"},
117117
CustomDataForAuthUsers: "secret data for auth'd users only",
118118
}
119119

‎mux_test.go‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,9 @@ func TestMuxBig(t *testing.T) {
800800
}
801801

802802
func bigMux() Router {
803-
var r, sr1, sr2, sr3, sr4, sr5, sr6 *Mux
803+
var r *Mux
804+
var sr3 *Mux
805+
// var sr1, sr2, sr3, sr4, sr5, sr6 *Mux
804806
r = NewRouter()
805807
r.Use(func(next http.Handler) http.Handler {
806808
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -866,9 +868,9 @@ func bigMux() Router {
866868
})
867869

868870
r.Route("/hubs", func(r Router) {
869-
sr1 = r.(*Mux)
871+
_ = r.(*Mux) // sr1
870872
r.Route("/{hubID}", func(r Router) {
871-
sr2 = r.(*Mux)
873+
_ = r.(*Mux) // sr2
872874
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
873875
ctx := r.Context()
874876
s := fmt.Sprintf("/hubs/%s reqid:%s session:%s",
@@ -890,7 +892,7 @@ func bigMux() Router {
890892
w.Write([]byte(s))
891893
})
892894
sr3.Route("/{webhookID}", func(r Router) {
893-
sr4 = r.(*Mux)
895+
_ = r.(*Mux) // sr4
894896
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
895897
ctx := r.Context()
896898
s := fmt.Sprintf("/hubs/%s/webhooks/%s reqid:%s session:%s", URLParam(r, "hubID"),
@@ -906,7 +908,7 @@ func bigMux() Router {
906908
}).Handler(sr3))
907909

908910
r.Route("/posts", func(r Router) {
909-
sr5 = r.(*Mux)
911+
_ = r.(*Mux) // sr5
910912
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
911913
ctx := r.Context()
912914
s := fmt.Sprintf("/hubs/%s/posts reqid:%s session:%s", URLParam(r, "hubID"),
@@ -918,7 +920,7 @@ func bigMux() Router {
918920
})
919921

920922
r.Route("/folders/", func(r Router) {
921-
sr6 = r.(*Mux)
923+
_ = r.(*Mux) // sr6
922924
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
923925
ctx := r.Context()
924926
s := fmt.Sprintf("/folders/ reqid:%s session:%s",
@@ -955,14 +957,14 @@ func TestMuxSubroutesBasic(t *testing.T) {
955957
})
956958

957959
r := NewRouter()
958-
var rr1, rr2 *Mux
960+
// var rr1, rr2 *Mux
959961
r.Get("/", hIndex)
960962
r.Route("/articles", func(r Router) {
961-
rr1 = r.(*Mux)
963+
// rr1 = r.(*Mux)
962964
r.Get("/", hArticlesList)
963965
r.Get("/search", hSearchArticles)
964966
r.Route("/{id}", func(r Router) {
965-
rr2 = r.(*Mux)
967+
// rr2 = r.(*Mux)
966968
r.Get("/", hGetArticle)
967969
r.Get("/sync", hSyncArticle)
968970
})
@@ -1050,9 +1052,9 @@ func TestMuxSubroutes(t *testing.T) {
10501052
sr3.Get("/", hAccountView1)
10511053
sr3.Get("/hi", hAccountView2)
10521054

1053-
var sr2 *Mux
1055+
// var sr2 *Mux
10541056
r.Route("/accounts/{accountID}", func(r Router) {
1055-
sr2 = r.(*Mux)
1057+
_ = r.(*Mux) // sr2
10561058
// r.Get("/", hAccountView1)
10571059
r.Mount("/", sr3)
10581060
})

0 commit comments

Comments
 (0)