Require go1.7 for compilation #2154

* Update the travis tests to exclude go1.6
  * Update the compile check to require go1.7+
  * Update misc go1.6 workarounds marked in the source
This commit is contained in:
Nick Craig-Wood 2018-04-06 19:04:31 +01:00
parent 32e02bd367
commit 67023f0040
4 changed files with 8 additions and 9 deletions

View File

@ -4,11 +4,10 @@ dist: trusty
os: os:
- linux - linux
go: go:
- 1.6.4
- 1.7.6 - 1.7.6
- 1.8.7 - 1.8.7
- 1.9.3 - 1.9.3
- "1.10" - "1.10.1"
- tip - tip
before_install: before_install:
- if [[ $TRAVIS_OS_NAME == linux ]]; then sudo modprobe fuse ; sudo chmod 666 /dev/fuse ; sudo chown root:$USER /etc/fuse.conf ; fi - if [[ $TRAVIS_OS_NAME == linux ]]; then sudo modprobe fuse ; sudo chmod 666 /dev/fuse ; sudo chown root:$USER /etc/fuse.conf ; fi
@ -39,7 +38,7 @@ matrix:
- go: tip - go: tip
include: include:
- os: osx - os: osx
go: "1.10" go: "1.10.1"
env: GOTAGS="" env: GOTAGS=""
deploy: deploy:
provider: script provider: script
@ -47,5 +46,5 @@ deploy:
skip_cleanup: true skip_cleanup: true
on: on:
all_branches: true all_branches: true
go: "1.10" go: "1.10.1"
condition: $TRAVIS_OS_NAME == linux && $TRAVIS_PULL_REQUEST == false condition: $TRAVIS_OS_NAME == linux && $TRAVIS_PULL_REQUEST == false

View File

@ -250,7 +250,7 @@ func cleanAuths(buf []byte) []byte {
func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error) { func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
// Get transactions per second token first if limiting // Get transactions per second token first if limiting
if tpsBucket != nil { if tpsBucket != nil {
tbErr := tpsBucket.Wait(context.Background()) // FIXME switch to req.Context() when we drop go1.6 support tbErr := tpsBucket.Wait(req.Context())
if tbErr != nil { if tbErr != nil {
fs.Errorf(nil, "HTTP token bucket error: %v", err) fs.Errorf(nil, "HTTP token bucket error: %v", err)
} }

View File

@ -49,7 +49,7 @@ func TestDurationString(t *testing.T) {
in time.Duration in time.Duration
want string want string
}{ }{
// {time.Duration(0), "0s"}, doesn't work on go1.6 {time.Duration(0), "0s"},
{time.Second, "1s"}, {time.Second, "1s"},
{time.Minute, "1m0s"}, {time.Minute, "1m0s"},
{time.Duration(DurationOff), "off"}, {time.Duration(DurationOff), "off"},

View File

@ -1,7 +1,7 @@
//+build !go1.6 //+build !go1.7
package fs package fs
// Upgrade to Go version 1.6 to compile rclone - latest stable go // Upgrade to Go version 1.7 to compile rclone - latest stable go
// compiler recommended. // compiler recommended.
func init() { Go_version_1_6_required_for_compilation() } func init() { Go_version_1_7_required_for_compilation() }