mirror of https://github.com/k3s-io/k3s
rename temp variable filepath to fpath
parent
27e5971c11
commit
37b9bd36f7
|
@ -338,19 +338,19 @@ func makeTar(srcPath, destPath string, writer io.Writer) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func recursiveTar(srcBase, srcFile, destBase, destFile string, tw *tar.Writer) error {
|
func recursiveTar(srcBase, srcFile, destBase, destFile string, tw *tar.Writer) error {
|
||||||
filepath := path.Join(srcBase, srcFile)
|
fpath := path.Join(srcBase, srcFile)
|
||||||
stat, err := os.Lstat(filepath)
|
stat, err := os.Lstat(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if stat.IsDir() {
|
if stat.IsDir() {
|
||||||
files, err := ioutil.ReadDir(filepath)
|
files, err := ioutil.ReadDir(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(files) == 0 {
|
if len(files) == 0 {
|
||||||
//case empty directory
|
//case empty directory
|
||||||
hdr, _ := tar.FileInfoHeader(stat, filepath)
|
hdr, _ := tar.FileInfoHeader(stat, fpath)
|
||||||
hdr.Name = destFile
|
hdr.Name = destFile
|
||||||
if err := tw.WriteHeader(hdr); err != nil {
|
if err := tw.WriteHeader(hdr); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -364,8 +364,8 @@ func recursiveTar(srcBase, srcFile, destBase, destFile string, tw *tar.Writer) e
|
||||||
return nil
|
return nil
|
||||||
} else if stat.Mode()&os.ModeSymlink != 0 {
|
} else if stat.Mode()&os.ModeSymlink != 0 {
|
||||||
//case soft link
|
//case soft link
|
||||||
hdr, _ := tar.FileInfoHeader(stat, filepath)
|
hdr, _ := tar.FileInfoHeader(stat, fpath)
|
||||||
target, err := os.Readlink(filepath)
|
target, err := os.Readlink(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ func recursiveTar(srcBase, srcFile, destBase, destFile string, tw *tar.Writer) e
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//case regular file or other file type like pipe
|
//case regular file or other file type like pipe
|
||||||
hdr, err := tar.FileInfoHeader(stat, filepath)
|
hdr, err := tar.FileInfoHeader(stat, fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ func recursiveTar(srcBase, srcFile, destBase, destFile string, tw *tar.Writer) e
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.Open(filepath)
|
f, err := os.Open(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue