mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-09-15 20:17:54 +00:00
run golangci-lint --fix
In order to fix the new formatting issues reported. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
62d5f150cf
commit
53a9bcbe13
17 changed files with 30 additions and 30 deletions
|
|
@ -163,7 +163,7 @@ func toMachineFormat(vms []*machine.ListResponse, defaultCon *config.Connection)
|
|||
isDefault := false
|
||||
// check port, in case we somehow have machines with the same name in different providers
|
||||
if defaultCon != nil {
|
||||
isDefault = vm.Name == defaultCon.Name && strings.Contains(defaultCon.URI, strconv.Itoa((vm.Port)))
|
||||
isDefault = vm.Name == defaultCon.Name && strings.Contains(defaultCon.URI, strconv.Itoa(vm.Port))
|
||||
}
|
||||
response := new(entities.ListReporter)
|
||||
response.Default = isDefault
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ func prune(_ *cobra.Command, _ []string) error {
|
|||
}
|
||||
|
||||
if !pruneOptions.External {
|
||||
fmt.Printf("Total reclaimed space: %s\n", units.HumanSize((float64)(response.ReclaimedSpace)))
|
||||
fmt.Printf("Total reclaimed space: %s\n", units.HumanSize(float64(response.ReclaimedSpace)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ func outputTemplate(cmd *cobra.Command, responses []*entities.VolumeListReport)
|
|||
return err
|
||||
}
|
||||
|
||||
if (rpt.RenderHeaders) && !noHeading {
|
||||
if rpt.RenderHeaders && !noHeading {
|
||||
if err := rpt.Execute(headers); err != nil {
|
||||
return fmt.Errorf("failed to write report column headers: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func reload(_ *cobra.Command, _ []string) error {
|
|||
}
|
||||
printReload("Added", report.Added)
|
||||
printReload("Removed", report.Removed)
|
||||
errs := (utils.OutputErrors)(report.Errors)
|
||||
errs := utils.OutputErrors(report.Errors)
|
||||
return errs.PrintErrors()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -616,7 +616,7 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
|
|||
}
|
||||
} else {
|
||||
for k, v := range ctr.config.Spec.Annotations {
|
||||
if !podmanOnly && (define.IsReservedAnnotation(k)) {
|
||||
if !podmanOnly && define.IsReservedAnnotation(k) {
|
||||
continue
|
||||
}
|
||||
podAnnotations[fmt.Sprintf("%s/%s", kubeAnnotationAlias(k), removeUnderscores(ctr.Name()))] = v
|
||||
|
|
|
|||
|
|
@ -1386,7 +1386,7 @@ func (r *Runtime) PruneContainers(filterFuncs []ContainerFilter) ([]*reports.Pru
|
|||
if err != nil {
|
||||
report.Err = err
|
||||
} else {
|
||||
report.Size = (uint64)(size)
|
||||
report.Size = uint64(size)
|
||||
}
|
||||
preports = append(preports, report)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ func isQualifiedName(value string) error {
|
|||
func validateAnnotationsSize(annotations map[string]string) error {
|
||||
var totalSize int64
|
||||
for k, v := range annotations {
|
||||
totalSize += (int64)(len(k)) + (int64)(len(v))
|
||||
totalSize += int64(len(k)) + int64(len(v))
|
||||
}
|
||||
if totalSize > (int64)(define.TotalAnnotationSizeLimitB) {
|
||||
if totalSize > int64(define.TotalAnnotationSizeLimitB) {
|
||||
return fmt.Errorf("annotations size %d is larger than limit %d", totalSize, define.TotalAnnotationSizeLimitB)
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
|||
|
||||
// MarshalErrorJSON writes error to stream as string
|
||||
func MarshalErrorJSON(ptr unsafe.Pointer, stream *jsoniter.Stream) {
|
||||
p := *((*error)(ptr))
|
||||
p := *(*error)(ptr)
|
||||
if p == nil {
|
||||
stream.WriteNil()
|
||||
} else {
|
||||
|
|
@ -128,7 +128,7 @@ func MarshalErrorJSON(ptr unsafe.Pointer, stream *jsoniter.Stream) {
|
|||
|
||||
// MarshalErrorSliceJSON writes []error to stream as []string JSON blob
|
||||
func MarshalErrorSliceJSON(ptr unsafe.Pointer, stream *jsoniter.Stream) {
|
||||
a := *((*[]error)(ptr))
|
||||
a := *(*[]error)(ptr)
|
||||
switch {
|
||||
case len(a) == 0:
|
||||
stream.WriteNil()
|
||||
|
|
@ -145,11 +145,11 @@ func MarshalErrorSliceJSON(ptr unsafe.Pointer, stream *jsoniter.Stream) {
|
|||
}
|
||||
|
||||
func MarshalErrorJSONIsEmpty(ptr unsafe.Pointer) bool {
|
||||
return *((*error)(ptr)) == nil
|
||||
return *(*error)(ptr) == nil
|
||||
}
|
||||
|
||||
func MarshalErrorSliceJSONIsEmpty(ptr unsafe.Pointer) bool {
|
||||
return len(*((*[]error)(ptr))) == 0
|
||||
return len(*(*[]error)(ptr)) == 0
|
||||
}
|
||||
|
||||
// ReadJSONFromBody reads JSON from a request body into the given struct.
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
|
|||
}
|
||||
// Ensure golang can determine that interfaces are "really" nil
|
||||
if !isSet.stdin {
|
||||
stdin = (io.Reader)(nil)
|
||||
stdin = io.Reader(nil)
|
||||
}
|
||||
if !isSet.stdout {
|
||||
stdout = (io.Writer)(nil)
|
||||
stdout = io.Writer(nil)
|
||||
}
|
||||
if !isSet.stderr {
|
||||
stderr = (io.Writer)(nil)
|
||||
stderr = io.Writer(nil)
|
||||
}
|
||||
|
||||
conn, err := bindings.GetClient(ctx)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func Events(ctx context.Context, eventChan chan types.Event, cancelChan chan boo
|
|||
defer response.Body.Close()
|
||||
defer close(eventChan)
|
||||
dec := json.NewDecoder(response.Body)
|
||||
for err = (error)(nil); err == nil; {
|
||||
for err = error(nil); err == nil; {
|
||||
e := types.Event{}
|
||||
err = dec.Decode(&e)
|
||||
if err == nil {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.Sys
|
|||
for k, v := range options.Filters {
|
||||
filters = append(filters, fmt.Sprintf("%s=%s", k, v[0]))
|
||||
}
|
||||
reclaimedSpace := (uint64)(0)
|
||||
reclaimedSpace := uint64(0)
|
||||
|
||||
// Prune Build Containers
|
||||
if options.Build {
|
||||
|
|
@ -114,7 +114,7 @@ func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.Sys
|
|||
|
||||
// Remove all unused containers.
|
||||
containerPruneOptions := entities.ContainerPruneOptions{}
|
||||
containerPruneOptions.Filters = (url.Values)(options.Filters)
|
||||
containerPruneOptions.Filters = url.Values(options.Filters)
|
||||
|
||||
containerPruneReports, err := ic.ContainerPrune(ctx, containerPruneOptions)
|
||||
if err != nil {
|
||||
|
|
@ -160,7 +160,7 @@ func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.Sys
|
|||
// Remove unused volume data.
|
||||
if options.Volume {
|
||||
volumePruneOptions := entities.VolumePruneOptions{}
|
||||
volumePruneOptions.Filters = (url.Values)(options.Filters)
|
||||
volumePruneOptions.Filters = url.Values(options.Filters)
|
||||
|
||||
if len(volumePruneOptions.Filters) == 0 {
|
||||
volumePruneOptions.Filters.Set("all", "true")
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ func ValidateSCPArgs(locations []*entities.ScpTransferImageOptions) error {
|
|||
// returns an int which contains the length of a specified index in a host::image string
|
||||
func RemoteArgLength(input string, side int) int {
|
||||
if strings.Contains(input, "::") {
|
||||
return len((strings.Split(input, "::"))[side])
|
||||
return len(strings.Split(input, "::")[side])
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ var _ = Describe("podman machine list", func() {
|
|||
startSession, err := mb.setCmd(s).runWithoutWait()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
wait := 3
|
||||
retries := (int)(mb.timeout/time.Second) / wait
|
||||
retries := int(mb.timeout/time.Second) / wait
|
||||
for range retries {
|
||||
listSession, err := mb.setCmd(l).run()
|
||||
Expect(listSession).To(Exit(0))
|
||||
|
|
@ -154,7 +154,7 @@ var _ = Describe("podman machine list", func() {
|
|||
Expect(session).To(Exit(0))
|
||||
|
||||
list := new(listMachine)
|
||||
list = list.withFormat(("json"))
|
||||
list = list.withFormat("json")
|
||||
listSession, err := mb.setCmd(list).run()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
var listResponse []*entities.ListReporter
|
||||
|
|
|
|||
|
|
@ -382,8 +382,8 @@ func WeightDevices(wtDevices map[string]spec.LinuxWeightDevice) ([]spec.LinuxWei
|
|||
return nil, fmt.Errorf("failed to inspect '%s' in --blkio-weight-device: %w", k, err)
|
||||
}
|
||||
dev := new(spec.LinuxWeightDevice)
|
||||
dev.Major = (int64(unix.Major(uint64(statT.Rdev)))) //nolint: unconvert
|
||||
dev.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) //nolint: unconvert
|
||||
dev.Major = int64(unix.Major(uint64(statT.Rdev))) //nolint: unconvert
|
||||
dev.Minor = int64(unix.Minor(uint64(statT.Rdev))) //nolint: unconvert
|
||||
dev.Weight = v.Weight
|
||||
devs = append(devs, *dev)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ func LimitToSwap(memory *specs.LinuxMemory, swap string, ml int64) {
|
|||
memory.Limit = &ml
|
||||
if swap == "" {
|
||||
limit := 2 * ml
|
||||
memory.Swap = &(limit)
|
||||
memory.Swap = &limit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ func CreatePortBindings(ports []string) ([]types.PortMapping, error) {
|
|||
case 1:
|
||||
// No protocol was provided
|
||||
case 2:
|
||||
proto = &(splitProto[1])
|
||||
proto = &splitProto[1]
|
||||
default:
|
||||
return nil, errors.New("invalid port format - protocol can only be specified once")
|
||||
}
|
||||
|
|
@ -132,14 +132,14 @@ func CreatePortBindings(ports []string) ([]types.PortMapping, error) {
|
|||
}
|
||||
ctrPort = splitPort[0]
|
||||
case 2:
|
||||
hostPort = &(splitPort[0])
|
||||
hostPort = &splitPort[0]
|
||||
ctrPort = splitPort[1]
|
||||
case 3:
|
||||
if haveV6 {
|
||||
return nil, errors.New("invalid port format - when v6 address specified, must be [ipv6]:hostPort:ctrPort")
|
||||
}
|
||||
hostIP = &(splitPort[0])
|
||||
hostPort = &(splitPort[1])
|
||||
hostIP = &splitPort[0]
|
||||
hostPort = &splitPort[1]
|
||||
ctrPort = splitPort[2]
|
||||
default:
|
||||
return nil, errors.New("invalid port format - format is [[hostIP:]hostPort:]containerPort")
|
||||
|
|
|
|||
|
|
@ -5458,7 +5458,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q
|
|||
podmanTest.PodmanExitCleanly("kube", "play", kubeYaml, "--log-driver", "journald", "--log-opt", "tag={{.ImageName}},withcomma")
|
||||
podmanTest.PodmanExitCleanly("start", getCtrNameInPod(pod))
|
||||
inspect := podmanTest.PodmanExitCleanly("inspect", getCtrNameInPod(pod))
|
||||
Expect((inspect.InspectContainerToJSON()[0]).HostConfig.LogConfig.Tag).To(Equal("{{.ImageName}},withcomma"))
|
||||
Expect(inspect.InspectContainerToJSON()[0].HostConfig.LogConfig.Tag).To(Equal("{{.ImageName}},withcomma"))
|
||||
})
|
||||
|
||||
It("using a user namespace", func() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue