mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #86409 from sshukun/fix-golint
Fix go-lint issues in package pkg/kubelet/checkpointmanager/testing/example_checkpoint_formats/v1
This commit is contained in:
commit
8cdf21ab4c
@ -100,7 +100,6 @@ pkg/kubeapiserver
|
|||||||
pkg/kubeapiserver/options
|
pkg/kubeapiserver/options
|
||||||
pkg/kubectl/cmd/convert
|
pkg/kubectl/cmd/convert
|
||||||
pkg/kubelet/apis/config/v1beta1
|
pkg/kubelet/apis/config/v1beta1
|
||||||
pkg/kubelet/checkpointmanager/testing/example_checkpoint_formats/v1
|
|
||||||
pkg/kubelet/cm
|
pkg/kubelet/cm
|
||||||
pkg/kubelet/container
|
pkg/kubelet/container
|
||||||
pkg/kubelet/container/testing
|
pkg/kubelet/container/testing
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
type protocol string
|
type protocol string
|
||||||
|
|
||||||
// portMapping is the port mapping configurations of a sandbox.
|
// PortMapping is the port mapping configurations of a sandbox.
|
||||||
type PortMapping struct {
|
type PortMapping struct {
|
||||||
// protocol of the port mapping.
|
// protocol of the port mapping.
|
||||||
Protocol *protocol
|
Protocol *protocol
|
||||||
@ -34,7 +34,7 @@ type PortMapping struct {
|
|||||||
HostPort *int32
|
HostPort *int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckpointData contains all types of data that can be stored in the checkpoint.
|
// Data contains all types of data that can be stored in the checkpoint.
|
||||||
type Data struct {
|
type Data struct {
|
||||||
PortMappings []*PortMapping `json:"port_mappings,omitempty"`
|
PortMappings []*PortMapping `json:"port_mappings,omitempty"`
|
||||||
HostNetwork bool `json:"host_network,omitempty"`
|
HostNetwork bool `json:"host_network,omitempty"`
|
||||||
@ -48,15 +48,18 @@ type CheckpointData struct {
|
|||||||
Checksum checksum.Checksum
|
Checksum checksum.Checksum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalCheckpoint tries to marshal the CheckpointData into JSON data.
|
||||||
func (cp *CheckpointData) MarshalCheckpoint() ([]byte, error) {
|
func (cp *CheckpointData) MarshalCheckpoint() ([]byte, error) {
|
||||||
cp.Checksum = checksum.New(*cp.Data)
|
cp.Checksum = checksum.New(*cp.Data)
|
||||||
return json.Marshal(*cp)
|
return json.Marshal(*cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalCheckpoint tries to unmarshal the passed JSON data into CheckpointData.
|
||||||
func (cp *CheckpointData) UnmarshalCheckpoint(blob []byte) error {
|
func (cp *CheckpointData) UnmarshalCheckpoint(blob []byte) error {
|
||||||
return json.Unmarshal(blob, cp)
|
return json.Unmarshal(blob, cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VerifyChecksum verifies that CheckpointData's checksum is same as the checksum calculated by its data.
|
||||||
func (cp *CheckpointData) VerifyChecksum() error {
|
func (cp *CheckpointData) VerifyChecksum() error {
|
||||||
return cp.Checksum.Verify(*cp.Data)
|
return cp.Checksum.Verify(*cp.Data)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user