modernize: JSON doesn't do "omitempty" structs, so stop asking
Drop the "omitempty" tag from the "json" tag on struct members that are themselves structs, since the JSON encoder doesn't actually do that, per golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
802b069799
commit
7aedebdccd
|
@ -132,8 +132,8 @@ type Builder struct {
|
||||||
ImageHistoryComment string `json:"history-comment,omitempty"`
|
ImageHistoryComment string `json:"history-comment,omitempty"`
|
||||||
|
|
||||||
// Image metadata and runtime settings, in multiple formats.
|
// Image metadata and runtime settings, in multiple formats.
|
||||||
OCIv1 v1.Image `json:"ociv1,omitempty"`
|
OCIv1 v1.Image `json:"ociv1"`
|
||||||
Docker docker.V2Image `json:"docker,omitempty"`
|
Docker docker.V2Image `json:"docker"`
|
||||||
// DefaultMountsFilePath is the file path holding the mounts to be mounted in "host-path:container-path" format.
|
// DefaultMountsFilePath is the file path holding the mounts to be mounted in "host-path:container-path" format.
|
||||||
DefaultMountsFilePath string `json:"defaultMountsFilePath,omitempty"`
|
DefaultMountsFilePath string `json:"defaultMountsFilePath,omitempty"`
|
||||||
|
|
||||||
|
|
|
@ -162,13 +162,13 @@ type request struct {
|
||||||
preservedDirectory string
|
preservedDirectory string
|
||||||
Globs []string `json:",omitempty"` // used by stat, get
|
Globs []string `json:",omitempty"` // used by stat, get
|
||||||
preservedGlobs []string
|
preservedGlobs []string
|
||||||
StatOptions StatOptions `json:",omitempty"`
|
StatOptions StatOptions
|
||||||
GetOptions GetOptions `json:",omitempty"`
|
GetOptions GetOptions
|
||||||
PutOptions PutOptions `json:",omitempty"`
|
PutOptions PutOptions
|
||||||
MkdirOptions MkdirOptions `json:",omitempty"`
|
MkdirOptions MkdirOptions
|
||||||
RemoveOptions RemoveOptions `json:",omitempty"`
|
RemoveOptions RemoveOptions
|
||||||
EnsureOptions EnsureOptions `json:",omitempty"`
|
EnsureOptions EnsureOptions
|
||||||
ConditionalRemoveOptions ConditionalRemoveOptions `json:",omitempty"`
|
ConditionalRemoveOptions ConditionalRemoveOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (req *request) Excludes() []string {
|
func (req *request) Excludes() []string {
|
||||||
|
@ -248,15 +248,15 @@ func (req *request) GIDMap() []idtools.IDMap {
|
||||||
|
|
||||||
// Response encodes a single response.
|
// Response encodes a single response.
|
||||||
type response struct {
|
type response struct {
|
||||||
Error string `json:",omitempty"`
|
Error string `json:",omitempty"`
|
||||||
Stat statResponse `json:",omitempty"`
|
Stat statResponse
|
||||||
Eval evalResponse `json:",omitempty"`
|
Eval evalResponse
|
||||||
Get getResponse `json:",omitempty"`
|
Get getResponse
|
||||||
Put putResponse `json:",omitempty"`
|
Put putResponse
|
||||||
Mkdir mkdirResponse `json:",omitempty"`
|
Mkdir mkdirResponse
|
||||||
Remove removeResponse `json:",omitempty"`
|
Remove removeResponse
|
||||||
Ensure ensureResponse `json:",omitempty"`
|
Ensure ensureResponse
|
||||||
ConditionalRemove conditionalRemoveResponse `json:",omitempty"`
|
ConditionalRemove conditionalRemoveResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
// statResponse encodes a response for a single Stat request.
|
// statResponse encodes a response for a single Stat request.
|
||||||
|
|
|
@ -124,7 +124,7 @@ type V1Compatibility struct {
|
||||||
Created time.Time `json:"created"`
|
Created time.Time `json:"created"`
|
||||||
ContainerConfig struct {
|
ContainerConfig struct {
|
||||||
Cmd []string
|
Cmd []string
|
||||||
} `json:"container_config,omitempty"`
|
} `json:"container_config"`
|
||||||
Author string `json:"author,omitempty"`
|
Author string `json:"author,omitempty"`
|
||||||
ThrowAway bool `json:"throwaway,omitempty"`
|
ThrowAway bool `json:"throwaway,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ type V1Image struct {
|
||||||
// Container is the id of the container used to commit
|
// Container is the id of the container used to commit
|
||||||
Container string `json:"container,omitempty"`
|
Container string `json:"container,omitempty"`
|
||||||
// ContainerConfig is the configuration of the container that is committed into the image
|
// ContainerConfig is the configuration of the container that is committed into the image
|
||||||
ContainerConfig Config `json:"container_config,omitempty"`
|
ContainerConfig Config `json:"container_config"`
|
||||||
// DockerVersion specifies the version of Docker that was used to build the image
|
// DockerVersion specifies the version of Docker that was used to build the image
|
||||||
DockerVersion string `json:"docker_version,omitempty"`
|
DockerVersion string `json:"docker_version,omitempty"`
|
||||||
// Author is the name of the author that was specified when committing the image
|
// Author is the name of the author that was specified when committing the image
|
||||||
|
|
|
@ -202,7 +202,7 @@ func Merge(mergeStrategy define.SBOMMergeStrategy, inputOutputSBOM, inputSBOM, o
|
||||||
Dependencies []string `json:"dependencies,omitempty"`
|
Dependencies []string `json:"dependencies,omitempty"`
|
||||||
}
|
}
|
||||||
type purlDocument struct {
|
type purlDocument struct {
|
||||||
ImageContents purlImageContents `json:"image_contents,omitempty"`
|
ImageContents purlImageContents `json:"image_contents"`
|
||||||
}
|
}
|
||||||
purls := []string{}
|
purls := []string{}
|
||||||
seenPurls := make(map[string]struct{})
|
seenPurls := make(map[string]struct{})
|
||||||
|
|
|
@ -880,7 +880,7 @@ func buildPost(t *testing.T, test testCase, err error, buildTool, outputString,
|
||||||
// FSTree holds the information we have about an image's filesystem
|
// FSTree holds the information we have about an image's filesystem
|
||||||
type FSTree struct {
|
type FSTree struct {
|
||||||
Layers []Layer `json:"layers,omitempty"`
|
Layers []Layer `json:"layers,omitempty"`
|
||||||
Tree FSEntry `json:"tree,omitempty"`
|
Tree FSEntry `json:"tree"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layer keeps track of the digests and contents of a layer blob
|
// Layer keeps track of the digests and contents of a layer blob
|
||||||
|
@ -900,7 +900,7 @@ type FSHeader struct {
|
||||||
Mode int64 `json:"mode,omitempty"`
|
Mode int64 `json:"mode,omitempty"`
|
||||||
UID int `json:"uid"`
|
UID int `json:"uid"`
|
||||||
GID int `json:"gid"`
|
GID int `json:"gid"`
|
||||||
ModTime time.Time `json:"mtime,omitempty"`
|
ModTime time.Time `json:"mtime"`
|
||||||
Devmajor int64 `json:"devmajor,omitempty"`
|
Devmajor int64 `json:"devmajor,omitempty"`
|
||||||
Devminor int64 `json:"devminor,omitempty"`
|
Devminor int64 `json:"devminor,omitempty"`
|
||||||
Xattrs map[string]string `json:"xattrs,omitempty"`
|
Xattrs map[string]string `json:"xattrs,omitempty"`
|
||||||
|
|
Loading…
Reference in New Issue