mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
bump golangci-lint to v1.50.1
Also fix a number of duplicate words. Yet disable the new `dupword` linter as it displays too many false positives. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@ -15,6 +15,7 @@ linters:
|
||||
# All these break for one reason or another
|
||||
- tagliatelle # too many JSON keys cannot be changed due to compat
|
||||
- nosnakecase # too many false positives due to the `unix` package
|
||||
- dupword # too many false positives (e.g., in tests)
|
||||
- gocognit
|
||||
- testpackage
|
||||
- goerr113
|
||||
|
2
Makefile
2
Makefile
@ -914,7 +914,7 @@ install.tools: .install.golangci-lint .install.swagger ## Install needed tools
|
||||
|
||||
.PHONY: .install.golangci-lint
|
||||
.install.golangci-lint:
|
||||
VERSION=1.49.0 ./hack/install_golangci.sh
|
||||
VERSION=1.50.1 ./hack/install_golangci.sh
|
||||
|
||||
.PHONY: .install.swagger
|
||||
.install.swagger:
|
||||
|
@ -203,7 +203,7 @@ func run(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
report, err := registry.ContainerEngine().ContainerRun(registry.GetContext(), runOpts)
|
||||
// report.ExitCode is set by ContainerRun even it it returns an error
|
||||
// report.ExitCode is set by ContainerRun even it returns an error
|
||||
if report != nil {
|
||||
registry.SetExitCode(report.ExitCode)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ var (
|
||||
|
||||
// ABIMode used in cobra.Annotations registry.EngineMode when command only supports ABIMode
|
||||
ABIMode = entities.ABIMode.String()
|
||||
// TunnelMode used in in cobra.Annotations registry.EngineMode when command only supports TunnelMode
|
||||
// TunnelMode used in cobra.Annotations registry.EngineMode when command only supports TunnelMode
|
||||
TunnelMode = entities.TunnelMode.String()
|
||||
)
|
||||
|
||||
|
@ -261,7 +261,7 @@ func isUnambiguousName(imageName string) bool {
|
||||
// What is before the first slash can be a domain or a path
|
||||
domain := imageName[:firstSlash]
|
||||
|
||||
// If its a a domain (has dot or port or is "localhost") it is considered fq
|
||||
// If its a domain (has dot or port or is "localhost") it is considered fq
|
||||
if strings.ContainsAny(domain, ".:") || domain == "localhost" {
|
||||
return true
|
||||
}
|
||||
|
@ -3451,7 +3451,7 @@ func (s *BoltState) RemoveContainerFromPod(pod *Pod, ctr *Container) error {
|
||||
return fmt.Errorf("pod %s is in namespace %q but we are in namespace %q: %w", pod.ID(), pod.config.Namespace, s.namespace, define.ErrNSMismatch)
|
||||
}
|
||||
if s.namespace != ctr.config.Namespace {
|
||||
return fmt.Errorf("container %s in in namespace %q but we are in namespace %q: %w", ctr.ID(), ctr.config.Namespace, s.namespace, define.ErrNSMismatch)
|
||||
return fmt.Errorf("container %s in namespace %q but we are in namespace %q: %w", ctr.ID(), ctr.config.Namespace, s.namespace, define.ErrNSMismatch)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1253,7 +1253,7 @@ func (c *Container) Secrets() []*ContainerSecret {
|
||||
// values at runtime via network connect and disconnect.
|
||||
// If the container is configured to use CNI and this function returns an empty
|
||||
// array, the container will still be connected to the default network.
|
||||
// The second return parameter, a bool, indicates that the container container
|
||||
// The second return parameter, a bool, indicates that the container
|
||||
// is joining the default CNI network - the network name will be included in the
|
||||
// returned array of network names, but the container did not explicitly join
|
||||
// this network.
|
||||
|
@ -13,7 +13,7 @@ const (
|
||||
// InspectResponseFalse) it will be used in the output of Inspect().
|
||||
InspectAnnotationAutoremove = "io.podman.annotations.autoremove"
|
||||
// InspectAnnotationVolumesFrom is used by Inspect to identify
|
||||
// containers whose volumes are are being used by this container.
|
||||
// containers whose volumes are being used by this container.
|
||||
// It is expected to be a comma-separated list of container names and/or
|
||||
// IDs.
|
||||
// If an annotation with this key is found in the OCI spec, it will be
|
||||
|
@ -25,7 +25,7 @@ const (
|
||||
ContainerStateStopped ContainerStatus = iota
|
||||
// ContainerStatePaused indicates that the container has been paused
|
||||
ContainerStatePaused ContainerStatus = iota
|
||||
// ContainerStateExited indicates the the container has stopped and been
|
||||
// ContainerStateExited indicates the container has stopped and been
|
||||
// cleaned up
|
||||
ContainerStateExited ContainerStatus = iota
|
||||
// ContainerStateRemoving indicates the container is in the process of
|
||||
|
@ -16,7 +16,7 @@ type ReverseReader struct {
|
||||
|
||||
// NewReverseReader returns a reader that reads from the end of a file
|
||||
// rather than the beginning. It sets the readsize to pagesize and determines
|
||||
// the first offset using using modulus.
|
||||
// the first offset using modulus.
|
||||
func NewReverseReader(reader *os.File) (*ReverseReader, error) {
|
||||
// pagesize should be safe for memory use and file reads should be on page
|
||||
// boundaries as well
|
||||
|
@ -296,7 +296,7 @@ func WithHooksDir(hooksDirs ...string) RuntimeOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithCDI sets the devices to check for for CDI configuration.
|
||||
// WithCDI sets the devices to check for CDI configuration.
|
||||
func WithCDI(devices []string) CtrCreateOption {
|
||||
return func(ctr *Container) error {
|
||||
if ctr.valid {
|
||||
@ -307,7 +307,7 @@ func WithCDI(devices []string) CtrCreateOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithStorageOpts sets the devices to check for for CDI configuration.
|
||||
// WithStorageOpts sets the devices to check for CDI configuration.
|
||||
func WithStorageOpts(storageOpts map[string]string) CtrCreateOption {
|
||||
return func(ctr *Container) error {
|
||||
if ctr.valid {
|
||||
|
@ -44,7 +44,7 @@ func (p *Pod) save() error {
|
||||
// This cannot lock any other pod, but may lock individual containers, as those
|
||||
// will have refreshed by the time pod refresh runs.
|
||||
func (p *Pod) refresh() error {
|
||||
// Need to to an update from the DB to pull potentially-missing state
|
||||
// Need to do an update from the DB to pull potentially-missing state
|
||||
if err := p.runtime.state.UpdatePod(p); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ func Restart(ctx context.Context, nameOrID string, options *RestartOptions) (*en
|
||||
return &report, response.ProcessWithError(&report, &errorhandling.PodConflictErrorModel{})
|
||||
}
|
||||
|
||||
// Remove deletes a Pod from from local storage. The optional force parameter denotes
|
||||
// Remove deletes a Pod from local storage. The optional force parameter denotes
|
||||
// that the Pod can be removed even if in a running state.
|
||||
func Remove(ctx context.Context, nameOrID string, options *RemoveOptions) (*entities.PodRmReport, error) {
|
||||
var report entities.PodRmReport
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// WriteCloser is an io.WriteCloser that that proxies Write() calls to a channel
|
||||
// WriteCloser is an io.WriteCloser that proxies Write() calls to a channel
|
||||
// The []byte buffer of the Write() is queued on the channel as one message.
|
||||
type WriteCloser interface {
|
||||
io.WriteCloser
|
||||
|
@ -21,7 +21,7 @@ type Overrides struct {
|
||||
ContainerEtcGroupPath string
|
||||
}
|
||||
|
||||
// GetUserGroupInfo takes string forms of the the container's mount path and the container user and
|
||||
// GetUserGroupInfo takes string forms of the container's mount path and the container user and
|
||||
// returns a ExecUser with uid, gid, sgids, and home. And override can be provided for defaults.
|
||||
func GetUserGroupInfo(containerMount, containerUser string, override *Overrides) (*user.ExecUser, error) {
|
||||
var (
|
||||
|
@ -135,7 +135,7 @@ func GetAvailableGids() (int64, error) {
|
||||
return countAvailableIDs(gids), nil
|
||||
}
|
||||
|
||||
// findIDInMappings find the the mapping that contains the specified ID.
|
||||
// findIDInMappings find the mapping that contains the specified ID.
|
||||
// It assumes availableMappings is sorted by ID.
|
||||
func findIDInMappings(id int64, availableMappings []user.IDMap) *user.IDMap {
|
||||
i := sort.Search(len(availableMappings), func(i int) bool {
|
||||
|
@ -672,7 +672,7 @@ func TestParsePortMappingWithoutHostPort(t *testing.T) {
|
||||
assert.NoError(t, err, "error is not nil")
|
||||
|
||||
// because we always get random host ports when it is set to 0 we cannot check that exactly
|
||||
// check if it is not 0 and set to to 0 afterwards
|
||||
// check if it is not 0 and set to 0 afterwards
|
||||
for i := range got {
|
||||
assert.Greater(t, got[i].HostPort, uint16(0), "host port is zero")
|
||||
got[i].HostPort = 0
|
||||
|
@ -25,8 +25,7 @@ const (
|
||||
// Default indicates the spec generator should determine
|
||||
// a sane default
|
||||
Default NamespaceMode = "default"
|
||||
// Host means the the namespace is derived from
|
||||
// the host
|
||||
// Host means the namespace is derived from the host
|
||||
Host NamespaceMode = "host"
|
||||
// Path is the path to a namespace
|
||||
Path NamespaceMode = "path"
|
||||
|
@ -431,7 +431,7 @@ RUN > file2
|
||||
`
|
||||
podmanTest.BuildImageWithLabel(dockerfile, "foobar.com/workdir:latest", "false", "abc")
|
||||
podmanTest.BuildImageWithLabel(dockerfile2, "foobar.com/workdir:latest", "false", "xyz")
|
||||
// --force used to to avoid y/n question
|
||||
// --force used to avoid y/n question
|
||||
result := podmanTest.Podman([]string{"image", "prune", "--filter", "label=abc", "--force"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
|
Reference in New Issue
Block a user