Skip to content

Commit

Permalink
Merge pull request #22954 from Luap99/lint
Browse files Browse the repository at this point in the history
update golangci-lint to v1.59.1
  • Loading branch information
openshift-merge-bot[bot] authored Jun 10, 2024
2 parents 88308aa + fa4f11f commit b0780de
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ BUILDTAGS += ${EXTRA_BUILDTAGS}
# N/B: This value is managed by Renovate, manual changes are
# possible, as long as they don't disturb the formatting
# (i.e. DO NOT ADD A 'v' prefix!)
GOLANGCI_LINT_VERSION := 1.59.0
GOLANGCI_LINT_VERSION := 1.59.1
PYTHON ?= $(shell command -v python3 python|head -n1)
PKG_MANAGER ?= $(shell command -v dnf yum|head -n1)
# ~/.local/bin is not in PATH on all systems
Expand Down
6 changes: 3 additions & 3 deletions cmd/podman/containers/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,14 @@ func jsonOut(responses []entities.ListContainer) error {
return nil
}

func quietOut(responses []entities.ListContainer) error {
func quietOut(responses []entities.ListContainer) {
for _, r := range responses {
id := r.ID
if !noTrunc {
id = id[0:12]
}
fmt.Println(id)
}
return nil
}

func getResponses() ([]entities.ListContainer, error) {
Expand Down Expand Up @@ -217,7 +216,8 @@ func ps(cmd *cobra.Command, _ []string) error {
case report.IsJSON(listOpts.Format):
return jsonOut(listContainers)
case listOpts.Quiet && !cmd.Flags().Changed("format"):
return quietOut(listContainers)
quietOut(listContainers)
return nil
}

responses := make([]psReporter, 0, len(listContainers))
Expand Down
7 changes: 6 additions & 1 deletion pkg/bindings/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,30 +321,35 @@ func (c *Connection) GetDialer(ctx context.Context) (net.Conn, error) {

// IsInformational returns true if the response code is 1xx
func (h *APIResponse) IsInformational() bool {
//nolint:usestdlibvars // linter wants to use http.StatusContinue over 100 but that makes less readable IMO
return h.Response.StatusCode/100 == 1
}

// IsSuccess returns true if the response code is 2xx
func (h *APIResponse) IsSuccess() bool {
//nolint:usestdlibvars // linter wants to use http.StatusContinue over 100 but that makes less readable IMO
return h.Response.StatusCode/100 == 2
}

// IsRedirection returns true if the response code is 3xx
func (h *APIResponse) IsRedirection() bool {
//nolint:usestdlibvars // linter wants to use http.StatusContinue over 100 but that makes less readable IMO
return h.Response.StatusCode/100 == 3
}

// IsClientError returns true if the response code is 4xx
func (h *APIResponse) IsClientError() bool {
//nolint:usestdlibvars // linter wants to use http.StatusContinue over 100 but that makes less readable IMO
return h.Response.StatusCode/100 == 4
}

// IsConflictError returns true if the response code is 409
func (h *APIResponse) IsConflictError() bool {
return h.Response.StatusCode == 409
return h.Response.StatusCode == http.StatusConflict
}

// IsServerError returns true if the response code is 5xx
func (h *APIResponse) IsServerError() bool {
//nolint:usestdlibvars // linter wants to use http.StatusContinue over 100 but that makes less readable IMO
return h.Response.StatusCode/100 == 5
}
2 changes: 1 addition & 1 deletion pkg/bindings/containers/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func Export(ctx context.Context, nameOrID string, w io.Writer, options *ExportOp
}
defer response.Body.Close()

if response.StatusCode/100 == 2 {
if response.IsSuccess() {
_, err = io.Copy(w, response.Body)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindings/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func Export(ctx context.Context, nameOrIDs []string, w io.Writer, options *Expor
}
defer response.Body.Close()

if response.StatusCode/100 == 2 || response.StatusCode/100 == 3 {
if response.IsSuccess() || response.IsRedirection() {
_, err = io.Copy(w, response.Body)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/machine/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func WaitAndPingAPI(sock string) {
if err == nil {
defer resp.Body.Close()
}
if err != nil || resp.StatusCode != 200 {
if err != nil || resp.StatusCode != http.StatusOK {
logrus.Warn("API socket failed ping test")
}
}

1 comment on commit b0780de

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.