build: drop support for go1.8

This commit is contained in:
Nick Craig-Wood 2019-04-15 20:03:33 +01:00
parent 613a9bb86b
commit 16d8014cbb
36 changed files with 40 additions and 202 deletions

View File

@ -49,9 +49,6 @@ matrix:
allow_failures:
- go: tip
include:
- go: 1.8.x
script:
- make quicktest
- go: 1.9.x
script:
- make quicktest

View File

@ -1,6 +1,6 @@
// Package azureblob provides an interface to the Microsoft Azure blob object storage system
// +build !plan9,!solaris,go1.8
// +build !plan9,!solaris
package azureblob

View File

@ -1,4 +1,4 @@
// +build !plan9,!solaris,go1.8
// +build !plan9,!solaris
package azureblob

View File

@ -1,6 +1,6 @@
// Test AzureBlob filesystem interface
// +build !plan9,!solaris,go1.8
// +build !plan9,!solaris
package azureblob

View File

@ -1,6 +1,6 @@
// Build for azureblob for unsupported platforms to stop go complaining
// about "no buildable Go source files "
// +build plan9 solaris !go1.8
// +build plan9 solaris
package azureblob

View File

@ -1,7 +1,4 @@
// Package drive interfaces with the Google Drive object storage system
// +build go1.9
package drive
// FIXME need to deal with some corner cases

View File

@ -1,5 +1,3 @@
// +build go1.9
package drive
import (

View File

@ -1,7 +1,5 @@
// Test Drive filesystem interface
// +build go1.9
package drive
import (

View File

@ -1,6 +0,0 @@
// Build for unsupported platforms to stop go complaining
// about "no buildable Go source files "
// +build !go1.9
package drive

View File

@ -8,8 +8,6 @@
//
// This contains code adapted from google.golang.org/api (C) the GO AUTHORS
// +build go1.9
package drive
import (

View File

@ -1,7 +1,4 @@
// Package googlecloudstorage provides an interface to Google Cloud Storage
// +build go1.9
package googlecloudstorage
/*

View File

@ -1,7 +1,5 @@
// Test GoogleCloudStorage filesystem interface
// +build go1.9
package googlecloudstorage_test
import (

View File

@ -1,6 +0,0 @@
// Build for unsupported platforms to stop go complaining
// about "no buildable Go source files "
// +build !go1.9
package googlecloudstorage

View File

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

View File

@ -1,6 +1,6 @@
// Package sftp provides a filesystem interface using github.com/pkg/sftp
// +build !plan9,go1.9
// +build !plan9
package sftp

View File

@ -1,4 +1,4 @@
// +build !plan9,go1.9
// +build !plan9
package sftp

View File

@ -1,6 +1,6 @@
// Test Sftp filesystem interface
// +build !plan9,go1.9
// +build !plan9
package sftp_test

View File

@ -1,6 +1,6 @@
// Build for sftp for unsupported platforms to stop go complaining
// about "no buildable Go source files "
// +build plan9 !go1.9
// +build plan9
package sftp

View File

@ -1,4 +1,4 @@
// +build !plan9,go1.9
// +build !plan9
package sftp

View File

@ -1,4 +1,4 @@
// +build !plan9,go1.9
// +build !plan9
package sftp

View File

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

View File

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

View File

@ -1,21 +0,0 @@
// HTTP parts go1.8+
//+build go1.8
package httplib
import (
"net/http"
"time"
)
// Initialise the http.Server for post go1.8
func initServer(s *http.Server) {
s.ReadHeaderTimeout = 10 * time.Second // time to send the headers
s.IdleTimeout = 60 * time.Second // time to keep idle connections open
}
// closeServer closes the server in a non graceful way
func closeServer(s *http.Server) error {
return s.Close()
}

View File

@ -1,18 +0,0 @@
// HTTP parts pre go1.8
//+build !go1.8
package httplib
import (
"net/http"
)
// Initialise the http.Server for pre go1.8
func initServer(s *http.Server) {
}
// closeServer closes the server in a non graceful way
func closeServer(s *http.Server) error {
return nil
}

View File

@ -180,17 +180,17 @@ func NewServer(handler http.Handler, opt *Options) *Server {
// FIXME make a transport?
s.httpServer = &http.Server{
Addr: s.Opt.ListenAddr,
Handler: handler,
ReadTimeout: s.Opt.ServerReadTimeout,
WriteTimeout: s.Opt.ServerWriteTimeout,
MaxHeaderBytes: s.Opt.MaxHeaderBytes,
Addr: s.Opt.ListenAddr,
Handler: handler,
ReadTimeout: s.Opt.ServerReadTimeout,
WriteTimeout: s.Opt.ServerWriteTimeout,
MaxHeaderBytes: s.Opt.MaxHeaderBytes,
ReadHeaderTimeout: 10 * time.Second, // time to send the headers
IdleTimeout: 60 * time.Second, // time to keep idle connections open
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS10, // disable SSL v3.0 and earlier
},
}
// go version specific initialisation
initServer(s.httpServer)
if s.Opt.ClientCA != "" {
if !s.useSSL {
@ -267,7 +267,7 @@ func (s *Server) Wait() {
// Close shuts the running server down
func (s *Server) Close() {
err := closeServer(s.httpServer)
err := s.httpServer.Close()
if err != nil {
log.Printf("Error on closing HTTP server: %v", err)
return

View File

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

View File

@ -1,7 +1,7 @@
//+build !go1.8
//+build !go1.9
package fs
// Upgrade to Go version 1.8 to compile rclone - latest stable go
// Upgrade to Go version 1.9 to compile rclone - latest stable go
// compiler recommended.
func init() { Go_version_1_8_required_for_compilation() }
func init() { Go_version_1_9_required_for_compilation() }

View File

@ -1,33 +0,0 @@
//+build !go1.9
package fstests
func leadingZeros64(x uint64) int {
var n uint64 = 64
if y := x >> 32; y != 0 {
n = n - 32
x = y
}
if y := x >> 16; y != 0 {
n = n - 16
x = y
}
if y := x >> 8; y != 0 {
n = n - 8
x = y
}
if y := x >> 4; y != 0 {
n = n - 4
x = y
}
if y := x >> 2; y != 0 {
n = n - 2
x = y
}
if y := x >> 1; y != 0 {
return int(n - 2)
}
return int(n - x)
}

View File

@ -1,11 +0,0 @@
//+build go1.9
package fstests
import (
"math/bits"
)
func leadingZeros64(x uint64) int {
return bits.LeadingZeros64(x)
}

View File

@ -11,6 +11,7 @@ import (
"fmt"
"io"
"io/ioutil"
"math/bits"
"os"
"path"
"path/filepath"
@ -72,7 +73,7 @@ type SetUploadCutoffer interface {
// NextPowerOfTwo returns the current or next bigger power of two.
// All values less or equal 0 will return 0
func NextPowerOfTwo(i fs.SizeSuffix) fs.SizeSuffix {
return 1 << uint(64-leadingZeros64(uint64(i)-1))
return 1 << uint(64-bits.LeadingZeros64(uint64(i)-1))
}
// NextMultipleOf returns a function that can be used as a CeilChunkSize function.

View File

@ -590,3 +590,15 @@ func (s *authServer) Start() {
err = s.server.Serve(s.listener)
fs.Debugf(nil, "Closed auth server with error: %v", err)
}
func (s *authServer) Stop() {
fs.Debugf(nil, "Closing auth server")
if s.code != nil {
close(s.code)
s.code = nil
}
_ = s.listener.Close()
// close the server
_ = s.server.Close()
}

View File

@ -1,19 +0,0 @@
// oauthutil parts go1.8+
//+build go1.8
package oauthutil
import "github.com/ncw/rclone/fs"
func (s *authServer) Stop() {
fs.Debugf(nil, "Closing auth server")
if s.code != nil {
close(s.code)
s.code = nil
}
_ = s.listener.Close()
// close the server
_ = s.server.Close()
}

View File

@ -1,16 +0,0 @@
// oauthutil parts pre go1.8+
//+build !go1.8
package oauthutil
import "github.com/ncw/rclone/fs"
func (s *authServer) Stop() {
fs.Debugf(nil, "Closing auth server")
if s.code != nil {
close(s.code)
s.code = nil
}
_ = s.listener.Close()
}

View File

@ -24,11 +24,11 @@ const (
// Errors which have exact counterparts in os
var (
ENOENT = os.ErrNotExist
EEXIST = os.ErrExist
EPERM = os.ErrPermission
EINVAL = os.ErrInvalid
// ECLOSED see errors_{old,new}.go
ENOENT = os.ErrNotExist
EEXIST = os.ErrExist
EPERM = os.ErrPermission
EINVAL = os.ErrInvalid
ECLOSED = os.ErrClosed
)
var errorNames = []string{

View File

@ -1,10 +0,0 @@
// Errors for go1.8+
//+build go1.8
package vfs
import "os"
// ECLOSED is returned when a handle is closed twice
var ECLOSED = os.ErrClosed

View File

@ -1,10 +0,0 @@
// Errors for pre go1.8
//+build !go1.8
package vfs
import "errors"
// ECLOSED is returned when a handle is closed twice
var ECLOSED = errors.New("file already closed")