mirror of
https://github.com/rclone/rclone.git
synced 2025-08-18 17:38:52 +02:00
build: make go1.14 the minimum supported Go for building
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"github.com/dop251/scsu"
|
||||
"github.com/klauspost/compress/huff0"
|
||||
)
|
||||
|
||||
@@ -50,7 +51,7 @@ func DecodeBytes(table byte, data []byte) (string, error) {
|
||||
case tableReserved:
|
||||
return "", ErrUnsupported
|
||||
case tableSCSUPlain:
|
||||
return scsuDecode(data)
|
||||
return scsu.Decode(data)
|
||||
case tableRLE:
|
||||
if len(data) < 2 {
|
||||
return "", ErrCorrupted
|
||||
@@ -87,7 +88,7 @@ func DecodeBytes(table byte, data []byte) (string, error) {
|
||||
return "", ErrCorrupted
|
||||
}
|
||||
if table == tableSCSU {
|
||||
return scsuDecode(name)
|
||||
return scsu.Decode(name)
|
||||
}
|
||||
return string(name), nil
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package filename
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -120,10 +119,6 @@ func TestDecode(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := Decode(tt.encoded)
|
||||
if (err != nil) != tt.wantErr {
|
||||
if err != nil && err.Error() == scsuNotEnabled && runtime.Version() < "go1.13" {
|
||||
t.Skip(err.Error())
|
||||
return
|
||||
}
|
||||
if tt.encoded == "" && tt.want != "" {
|
||||
proposed := Encode(tt.want)
|
||||
table := decodeMap[proposed[0]] - 1
|
||||
|
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
|
||||
"github.com/dop251/scsu"
|
||||
"github.com/klauspost/compress/huff0"
|
||||
)
|
||||
|
||||
@@ -37,7 +38,7 @@ func EncodeBytes(s string) (table byte, payload []byte) {
|
||||
if i == tableSCSU {
|
||||
var err error
|
||||
olen := len(org)
|
||||
org, err = scsuEncodeStrict(s, make([]byte, 0, len(org)))
|
||||
org, err = scsu.EncodeStrict(s, make([]byte, 0, len(org)))
|
||||
if err != nil || olen <= len(org) {
|
||||
continue
|
||||
}
|
||||
|
@@ -1,16 +0,0 @@
|
||||
package filename
|
||||
|
||||
import "errors"
|
||||
|
||||
const scsuNotEnabled = "scsu encoding not enabled in this build due to old go version"
|
||||
|
||||
// Functions wrap scsu package, since it doesn't build on old Go versions.
|
||||
// Remove once v1.13 is minimum supported version.
|
||||
|
||||
var scsuDecode = func(b []byte) (string, error) {
|
||||
return "", errors.New(scsuNotEnabled)
|
||||
}
|
||||
|
||||
var scsuEncodeStrict = func(src string, dst []byte) ([]byte, error) {
|
||||
return nil, errors.New(scsuNotEnabled)
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
// +build go1.13
|
||||
|
||||
package filename
|
||||
|
||||
import "github.com/dop251/scsu"
|
||||
|
||||
func init() {
|
||||
scsuDecode = scsu.Decode
|
||||
scsuEncodeStrict = scsu.EncodeStrict
|
||||
}
|
Reference in New Issue
Block a user