From 3715b4c761ac9ba4e65786fa1943dc9b6ed97220 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 6 Apr 2017 13:36:53 -0700 Subject: [PATCH] specs-go/config: Make User.UID and User.GID pointers Avoiding: $ go test ./specs-go --- FAIL: TestConfigRoundTrip (0.00s) --- FAIL: TestConfigRoundTrip/config_2 (0.00s) round_trip_test.go:35: failed to round-trip: {"ociVersion":"1.0.0","platform":{"os":"windows","arch":"amd64"},"process":{"user":{"uid":0,"gid":0,"username":"containeradministrator"},"args":["sh"],"cwd":"C:\\"},"root":{"path":"rootfs"}} FAIL FAIL github.com/opencontainers/runtime-spec/specs-go 0.003s We can't just add omitempty (without also making them pointers), because 0 is a meaningful value for both properties. Signed-off-by: W. Trevor King --- specs-go/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs-go/config.go b/specs-go/config.go index df0749094..5b06dde4f 100644 --- a/specs-go/config.go +++ b/specs-go/config.go @@ -82,9 +82,9 @@ type Box struct { // User specifies specific user (and group) information for the container process. type User struct { // UID is the user id. - UID uint32 `json:"uid" platform:"linux,solaris"` + UID *uint32 `json:"uid,omitempty" platform:"linux,solaris"` // GID is the group id. - GID uint32 `json:"gid" platform:"linux,solaris"` + GID *uint32 `json:"gid,omitempty" platform:"linux,solaris"` // AdditionalGids are additional group ids set for the container's process. AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux,solaris"` // Username is the user name.