Replace stdlib errors with github.com/pkg/errors

This commit is contained in:
Alexander Neumann 2016-08-21 17:46:23 +02:00
parent 17a38faa43
commit 444a268ce0
48 changed files with 92 additions and 47 deletions

View File

@ -2,7 +2,6 @@ package main
import (
"bufio"
"errors"
"fmt"
"os"
"path/filepath"
@ -14,6 +13,8 @@ import (
"strings"
"time"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh/terminal"
)

View File

@ -2,10 +2,11 @@ package main
import (
"encoding/json"
"errors"
"fmt"
"os"
"github.com/pkg/errors"
"restic"
"restic/backend"
"restic/debug"

View File

@ -1,11 +1,12 @@
package main
import (
"errors"
"fmt"
"os"
"time"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh/terminal"
"restic"

View File

@ -8,6 +8,8 @@ import (
"io"
"os"
"github.com/pkg/errors"
"restic"
"restic/backend"
"restic/pack"

View File

@ -1,7 +1,7 @@
package main
import (
"errors"
"github.com/pkg/errors"
"restic/repository"
)

View File

@ -1,9 +1,10 @@
package main
import (
"errors"
"fmt"
"github.com/pkg/errors"
"restic/backend"
"restic/repository"
)

View File

@ -1,9 +1,10 @@
package main
import (
"errors"
"fmt"
"github.com/pkg/errors"
"restic/backend"
)

View File

@ -1,9 +1,10 @@
package main
import (
"errors"
"fmt"
"github.com/pkg/errors"
"restic"
"restic/backend"
"restic/debug"

View File

@ -1,7 +1,6 @@
package main
import (
"errors"
"fmt"
"io"
"os"
@ -9,6 +8,8 @@ import (
"strings"
"syscall"
"github.com/pkg/errors"
"restic/backend"
"restic/backend/local"
"restic/backend/rest"

View File

@ -2,11 +2,12 @@ package main
import (
"fmt"
"github.com/jessevdk/go-flags"
"os"
"restic"
"restic/debug"
"runtime"
"github.com/jessevdk/go-flags"
)
func init() {

View File

@ -2,7 +2,6 @@ package restic
import (
"encoding/json"
"errors"
"fmt"
"io"
"os"
@ -11,6 +10,8 @@ import (
"sync"
"time"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"
"restic/fs"

View File

@ -2,13 +2,14 @@ package restic_test
import (
"crypto/rand"
"errors"
"io"
mrand "math/rand"
"sync"
"testing"
"time"
"github.com/pkg/errors"
"restic"
"restic/backend"
"restic/pack"

View File

@ -1,6 +1,6 @@
package backend
import "errors"
import "github.com/pkg/errors"
// ErrNoIDPrefixFound is returned by Find() when no ID for the given prefix
// could be found.

View File

@ -1,8 +1,9 @@
package backend
import (
"errors"
"fmt"
"github.com/pkg/errors"
)
// Handle is used to store and access data in a backend.

View File

@ -5,7 +5,8 @@ import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
"github.com/pkg/errors"
)
// Hash returns the ID for data.

View File

@ -1,8 +1,9 @@
package local
import (
"errors"
"strings"
"github.com/pkg/errors"
)
// ParseConfig parses a local backend config.

View File

@ -1,13 +1,14 @@
package local
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"
"restic/fs"

View File

@ -1,10 +1,11 @@
package mem
import (
"errors"
"io"
"sync"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"
)

View File

@ -1,7 +1,7 @@
package mem_test
import (
"errors"
"github.com/pkg/errors"
"restic/backend"
"restic/backend/mem"

View File

@ -1,6 +1,6 @@
package backend
import "errors"
import "github.com/pkg/errors"
// MockBackend implements a backend whose functions can be specified. This
// should only be used for tests.

View File

@ -1,9 +1,10 @@
package rest
import (
"errors"
"net/url"
"strings"
"github.com/pkg/errors"
)
// Config contains all configuration necessary to connect to a REST server.

View File

@ -3,7 +3,6 @@ package rest
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
@ -11,6 +10,8 @@ import (
"path"
"strings"
"github.com/pkg/errors"
"restic/backend"
)

View File

@ -1,11 +1,12 @@
package rest_test
import (
"errors"
"fmt"
"net/url"
"os"
"github.com/pkg/errors"
"restic/backend"
"restic/backend/rest"
"restic/backend/test"

View File

@ -1,10 +1,11 @@
package s3
import (
"errors"
"net/url"
"path"
"strings"
"github.com/pkg/errors"
)
// Config contains all configuration necessary to connect to an s3 compatible

View File

@ -2,10 +2,11 @@ package s3
import (
"bytes"
"errors"
"io"
"strings"
"github.com/pkg/errors"
"github.com/minio/minio-go"
"restic/backend"

View File

@ -1,11 +1,12 @@
package s3_test
import (
"errors"
"fmt"
"net/url"
"os"
"github.com/pkg/errors"
"restic/backend"
"restic/backend/s3"
"restic/backend/test"

View File

@ -1,11 +1,12 @@
package sftp
import (
"errors"
"fmt"
"net/url"
"path"
"strings"
"github.com/pkg/errors"
)
// Config collects all information required to connect to an sftp server.

View File

@ -4,7 +4,6 @@ import (
"bufio"
"crypto/rand"
"encoding/hex"
"errors"
"fmt"
"io"
"os"
@ -13,6 +12,8 @@ import (
"strings"
"time"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"

View File

@ -1,7 +1,7 @@
package test_test
import (
"errors"
"github.com/pkg/errors"
"restic/backend"
"restic/backend/mem"

View File

@ -1,7 +1,6 @@
package restic
import (
"errors"
"fmt"
"io"
"os"
@ -9,6 +8,8 @@ import (
"runtime"
"strings"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"
"restic/fs"

View File

@ -6,6 +6,8 @@ import (
"fmt"
"sync"
"github.com/pkg/errors"
"restic"
"restic/backend"
"restic/crypto"

View File

@ -5,9 +5,10 @@ import (
"crypto/cipher"
"crypto/rand"
"encoding/json"
"errors"
"fmt"
"github.com/pkg/errors"
"golang.org/x/crypto/poly1305"
)

View File

@ -1,9 +1,10 @@
package filter
import (
"errors"
"path/filepath"
"strings"
"github.com/pkg/errors"
)
// ErrBadString is returned when Match is called with the empty string as the

View File

@ -4,9 +4,10 @@
package fuse
import (
"errors"
"sync"
"github.com/pkg/errors"
"restic"
"restic/backend"
"restic/debug"

View File

@ -5,11 +5,12 @@ package fuse
import (
"bytes"
"errors"
"math/rand"
"testing"
"time"
"github.com/pkg/errors"
"bazil.org/fuse"
"restic"

View File

@ -4,11 +4,12 @@
package fuse
import (
"restic"
"restic/repository"
"bazil.org/fuse"
"bazil.org/fuse/fs"
"golang.org/x/net/context"
"restic"
"restic/repository"
)
// Statically ensure that *file implements the given interface

View File

@ -2,7 +2,6 @@
package index
import (
"errors"
"fmt"
"os"
"restic"
@ -12,6 +11,8 @@ import (
"restic/pack"
"restic/types"
"restic/worker"
"github.com/pkg/errors"
)
// Pack contains information about the contents of a pack.

View File

@ -1,8 +1,9 @@
package restic
import (
"errors"
"syscall"
"github.com/pkg/errors"
)
// mknod() creates a filesystem node (file, device

View File

@ -3,11 +3,12 @@ package pack
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"sync"
"github.com/pkg/errors"
"restic/backend"
"restic/crypto"
)

View File

@ -1,12 +1,13 @@
package pipe
import (
"errors"
"fmt"
"os"
"path/filepath"
"sort"
"github.com/pkg/errors"
"restic/debug"
"restic/fs"
)

View File

@ -4,10 +4,11 @@ import (
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"errors"
"io"
"testing"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"

View File

@ -3,12 +3,13 @@ package repository
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"sync"
"time"
"github.com/pkg/errors"
"restic/backend"
"restic/crypto"
"restic/debug"

View File

@ -2,12 +2,13 @@ package repository
import (
"encoding/json"
"errors"
"fmt"
"os"
"os/user"
"time"
"github.com/pkg/errors"
"restic/backend"
"restic/crypto"
"restic/debug"

View File

@ -1,11 +1,12 @@
package repository_test
import (
"errors"
"math/rand"
"testing"
"time"
"github.com/pkg/errors"
"restic/backend"
"restic/repository"
. "restic/test"

View File

@ -3,11 +3,12 @@ package repository
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"github.com/pkg/errors"
"restic/backend"
"restic/crypto"
"restic/debug"

View File

@ -1,13 +1,14 @@
package restic
import (
"errors"
"fmt"
"os"
"os/user"
"path/filepath"
"time"
"github.com/pkg/errors"
"restic/backend"
"restic/repository"
)

View File

@ -1,10 +1,11 @@
package restic
import (
"errors"
"fmt"
"sort"
"github.com/pkg/errors"
"restic/backend"
"restic/debug"
"restic/pack"

View File

@ -1,9 +1,10 @@
package worker_test
import (
"errors"
"testing"
"github.com/pkg/errors"
"restic/worker"
)