Bumps the version of go-winio.

This also refactors the lcow and windows
snapshotters to use go-winio's utility functions for checking the
filesystem type.

Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
This commit is contained in:
Eric Hotinger
2019-07-01 14:03:30 -07:00
parent 6617defdc9
commit 9fda4a5fe6
22 changed files with 796 additions and 188 deletions

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"math"
"reflect"
"syscall"
"time"
"unsafe"
)
@@ -380,6 +382,14 @@ func Struct(name string, opts ...FieldOpt) FieldOpt {
}
}
// Time adds a time to the event.
func Time(name string, value time.Time) FieldOpt {
return func(em *eventMetadata, ed *eventData) {
em.writeField(name, inTypeFileTime, outTypeDateTimeUTC, 0)
ed.writeFiletime(syscall.NsecToFiletime(value.UTC().UnixNano()))
}
}
// Currently, we support logging basic builtin types (int, string, etc), slices
// of basic builtin types, error, types derived from the basic types (e.g. "type
// foo int"), and structs (recursively logging their fields). We do not support
@@ -454,6 +464,8 @@ func SmartField(name string, v interface{}) FieldOpt {
return Float64Array(name, v)
case error:
return StringField(name, v.Error())
case time.Time:
return Time(name, v)
default:
switch rv := reflect.ValueOf(v); rv.Kind() {
case reflect.Bool: