remove go1.7 support

This commit is contained in:
thinkerou 2018-11-20 18:55:50 +08:00
parent bb486e7e21
commit a37abf2c05
8 changed files with 15 additions and 46 deletions

View File

@ -1,7 +1,6 @@
language: go
sudo: false
go:
- 1.7.x
- 1.8.x
- 1.9.x
- 1.10.x

View File

@ -120,7 +120,7 @@ $ go run main.go
## Prerequisite
Now Gin requires Go 1.7 or later and Go 1.8 will be required soon.
Now Gin requires Go 1.8 or later and Go 1.9 will be required soon.
## Quick start

View File

@ -14,7 +14,7 @@ import (
"strings"
)
const ginSupportMinGoVer = 7
const ginSupportMinGoVer = 8
// IsDebugging returns true if the framework is running in debug mode.
// Use SetMode(gin.ReleaseMode) to disable debug mode.
@ -66,7 +66,7 @@ func getMinVer(v string) (uint64, error) {
func debugPrintWARNINGDefault() {
if v, e := getMinVer(runtime.Version()); e == nil && v <= ginSupportMinGoVer {
debugPrint(`[WARNING] Now Gin requires Go 1.7 or later and Go 1.8 will be required soon.
debugPrint(`[WARNING] Now Gin requires Go 1.8 or later and Go 1.9 will be required soon.
`)
}

View File

@ -1,5 +1,3 @@
// +build go1.8
package main
import (

View File

@ -1,5 +1,3 @@
// +build go1.8
package main
import (

View File

@ -16,7 +16,8 @@ const (
defaultStatus = http.StatusOK
)
type responseWriterBase interface {
// ResponseWriter ...
type ResponseWriter interface {
http.ResponseWriter
http.Hijacker
http.Flusher
@ -37,6 +38,9 @@ type responseWriterBase interface {
// Forces to write the http header (status code + headers).
WriteHeaderNow()
// get the http.Pusher for server push
Pusher() http.Pusher
}
type responseWriter struct {
@ -113,3 +117,10 @@ func (w *responseWriter) Flush() {
w.WriteHeaderNow()
w.ResponseWriter.(http.Flusher).Flush()
}
func (w *responseWriter) Pusher() (pusher http.Pusher) {
if pusher, ok := w.ResponseWriter.(http.Pusher); ok {
return pusher
}
return nil
}

View File

@ -1,12 +0,0 @@
// Copyright 2018 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
// +build !go1.8
package gin
// ResponseWriter ...
type ResponseWriter interface {
responseWriterBase
}

View File

@ -1,25 +0,0 @@
// Copyright 2018 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
// +build go1.8
package gin
import (
"net/http"
)
// ResponseWriter ...
type ResponseWriter interface {
responseWriterBase
// get the http.Pusher for server push
Pusher() http.Pusher
}
func (w *responseWriter) Pusher() (pusher http.Pusher) {
if pusher, ok := w.ResponseWriter.(http.Pusher); ok {
return pusher
}
return nil
}