Index: src/github.com/docker/docker/pkg/archive/archive_unix.go --- src/github.com/docker/docker/pkg/archive/archive_unix.go.orig 2019-03-24 09:43:15.000000000 +0100 +++ src/github.com/docker/docker/pkg/archive/archive_unix.go 2019-03-24 09:44:17.043028000 +0100 @@ -62,7 +62,7 @@ s, ok := stat.(*syscall.Stat_t) if ok { - inode = s.Ino + inode = uint64(s.Ino) } return Index: src/github.com/docker/docker/pkg/archive/changes_unix.go --- src/github.com/docker/docker/pkg/archive/changes_unix.go.orig 2019-03-24 09:43:15.000000000 +0100 +++ src/github.com/docker/docker/pkg/archive/changes_unix.go 2019-03-24 09:44:17.043153000 +0100 @@ -35,7 +35,7 @@ } func getIno(fi os.FileInfo) uint64 { - return fi.Sys().(*syscall.Stat_t).Ino + return uint64(fi.Sys().(*syscall.Stat_t).Ino) } func hasHardlinks(fi os.FileInfo) bool { Index: src/github.com/docker/docker/pkg/system/mknod.go --- src/github.com/docker/docker/pkg/system/mknod.go.orig 2019-03-24 09:43:15.000000000 +0100 +++ src/github.com/docker/docker/pkg/system/mknod.go 2019-03-24 09:44:48.138507000 +0100 @@ -9,7 +9,7 @@ // Mknod creates a filesystem node (file, device special file or named pipe) named path // with attributes specified by mode and dev. func Mknod(path string, mode uint32, dev int) error { - return unix.Mknod(path, mode, dev) + return unix.Mknod(path, mode, uint64(dev)) } // Mkdev is used to build the value of linux devices (in /dev/) which specifies major Index: src/github.com/jwilder/docker-gen/template.go --- src/github.com/jwilder/docker-gen/template.go.orig 2019-03-24 09:38:29.000000000 +0100 +++ src/github.com/jwilder/docker-gen/template.go 2019-03-24 09:44:17.043445000 +0100 @@ -16,6 +16,7 @@ "regexp" "strconv" "strings" + "sort" "syscall" "text/template" ) @@ -409,6 +410,30 @@ return strings.TrimSpace(s) } +// sortStrings returns a sorted array of strings +func sortStrings(values []string) []string { + sort.Strings(values) + return values +} + +// sortObjects returns a sorted array of objects (sorted by object key field) +func sortObjects(objs interface{}, key string) (interface{}, error) { + objsVal, err := getArrayValues("sortObj", objs) + if err != nil { + return nil, err + } + data := make([]interface{}, objsVal.Len()) + for i := 0; i < objsVal.Len(); i++ { + data[i] = objsVal.Index(i).Interface() + } + sort.Slice(data, func(i, j int) bool { + a := reflect.ValueOf(deepGet(data[i], key)).Interface().(string) + b := reflect.ValueOf(deepGet(data[j], key)).Interface().(string) + return a < b + }) + return data, nil +} + // when returns the trueValue when the condition is true and the falseValue otherwise func when(condition bool, trueValue, falseValue interface{}) interface{} { if condition { @@ -447,6 +472,8 @@ "trimPrefix": trimPrefix, "trimSuffix": trimSuffix, "trim": trim, + "sortStrings": sortStrings, + "sortObjects": sortObjects, "when": when, "where": where, "whereNot": whereNot,