mirror of
https://github.com/octoleo/restic.git
synced 2024-11-21 20:35:12 +00:00
remove unused code
This commit is contained in:
parent
76d1866444
commit
38ea7ed4f6
@ -56,16 +56,6 @@ func verbose(f string, args ...interface{}) {
|
||||
fmt.Printf(f, args...)
|
||||
}
|
||||
|
||||
func run(cmd string, args ...string) {
|
||||
c := exec.Command(cmd, args...)
|
||||
c.Stdout = os.Stdout
|
||||
c.Stderr = os.Stderr
|
||||
err := c.Run()
|
||||
if err != nil {
|
||||
die("error running %s %s: %v", cmd, args, err)
|
||||
}
|
||||
}
|
||||
|
||||
func rm(file string) {
|
||||
err := os.Remove(file)
|
||||
|
||||
@ -78,13 +68,6 @@ func rm(file string) {
|
||||
}
|
||||
}
|
||||
|
||||
func rmdir(dir string) {
|
||||
err := os.RemoveAll(dir)
|
||||
if err != nil {
|
||||
die("error removing %v: %v", dir, err)
|
||||
}
|
||||
}
|
||||
|
||||
func mkdir(dir string) {
|
||||
err := os.MkdirAll(dir, 0755)
|
||||
if err != nil {
|
||||
@ -92,14 +75,6 @@ func mkdir(dir string) {
|
||||
}
|
||||
}
|
||||
|
||||
func getwd() string {
|
||||
pwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
die("Getwd(): %v", err)
|
||||
}
|
||||
return pwd
|
||||
}
|
||||
|
||||
func abs(dir string) string {
|
||||
absDir, err := filepath.Abs(dir)
|
||||
if err != nil {
|
||||
|
@ -25,25 +25,6 @@ var _ restic.Backend = &Local{}
|
||||
|
||||
const defaultLayout = "default"
|
||||
|
||||
// dirExists returns true if the name exists and is a directory.
|
||||
func dirExists(name string) bool {
|
||||
f, err := fs.Open(name)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
fi, err := f.Stat()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if err = f.Close(); err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return fi.IsDir()
|
||||
}
|
||||
|
||||
// Open opens the local backend as specified by config.
|
||||
func Open(cfg Config) (*Local, error) {
|
||||
debug.Log("open local backend at %v (layout %q)", cfg.Path, cfg.Layout)
|
||||
|
@ -231,22 +231,6 @@ func (be *Backend) Path() string {
|
||||
return be.cfg.Prefix
|
||||
}
|
||||
|
||||
// lenForFile returns the length of the file.
|
||||
func lenForFile(f *os.File) (int64, error) {
|
||||
fi, err := f.Stat()
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "Stat")
|
||||
}
|
||||
|
||||
pos, err := f.Seek(0, io.SeekCurrent)
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "Seek")
|
||||
}
|
||||
|
||||
size := fi.Size() - pos
|
||||
return size, nil
|
||||
}
|
||||
|
||||
// Save stores data in the backend at the handle.
|
||||
func (be *Backend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error {
|
||||
debug.Log("Save %v", h)
|
||||
|
@ -17,8 +17,6 @@ import (
|
||||
"github.com/ncw/swift"
|
||||
)
|
||||
|
||||
const connLimit = 10
|
||||
|
||||
// beSwift is a backend which stores the data on a swift endpoint.
|
||||
type beSwift struct {
|
||||
conn *swift.Connection
|
||||
|
@ -696,8 +696,3 @@ func (node *Node) fillTimes(stat statT) {
|
||||
node.ChangeTime = time.Unix(ctim.Unix())
|
||||
node.AccessTime = time.Unix(atim.Unix())
|
||||
}
|
||||
|
||||
func changeTime(stat statT) time.Time {
|
||||
ctim := stat.ctim()
|
||||
return time.Unix(ctim.Unix())
|
||||
}
|
||||
|
@ -36,16 +36,6 @@ func (TagList) Type() string {
|
||||
// TagLists consists of several TagList.
|
||||
type TagLists []TagList
|
||||
|
||||
// splitTagLists splits a slice of strings into a slice of TagLists using
|
||||
// SplitTagList.
|
||||
func splitTagLists(s []string) (l TagLists) {
|
||||
l = make([]TagList, 0, len(s))
|
||||
for _, t := range s {
|
||||
l = append(l, splitTagList(t))
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
func (l TagLists) String() string {
|
||||
return fmt.Sprintf("%v", []TagList(l))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user