1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-21 16:05:40 +00:00

keywords: fix keyword failure for windows

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-12-07 22:10:00 -05:00
parent 9fc0375857
commit f15c0ad821

View file

@ -10,28 +10,32 @@ import (
)
var (
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
// this is bsd specific https://www.freebsd.org/cgi/man.cgi?query=chflags&sektion=2
flagsKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
return emptyKV, nil
}
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
if hdr, ok := info.Sys().(*tar.Header); ok {
return fmt.Sprintf("uname=%s", hdr.Uname), nil
return KeyVal(fmt.Sprintf("uname=%s", hdr.Uname)), nil
}
return "", nil
return emptyKV, nil
}
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
if hdr, ok := info.Sys().(*tar.Header); ok {
return fmt.Sprintf("uid=%d", hdr.Uid), nil
return KeyVal(fmt.Sprintf("uid=%d", hdr.Uid)), nil
}
return "", nil
return emptyKV, nil
}
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
if hdr, ok := info.Sys().(*tar.Header); ok {
return fmt.Sprintf("gid=%d", hdr.Gid), nil
return KeyVal(fmt.Sprintf("gid=%d", hdr.Gid)), nil
}
return "", nil
return emptyKV, nil
}
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
return "", nil
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
return emptyKV, nil
}
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
return "", nil
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
return emptyKV, nil
}
)