enable gofumpt formatter

Based on our discussion gofumpt won the vote so use that one via
golangci-lint.

https://github.com/containers/podman/discussions/27291

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-11-11 12:12:42 +01:00
parent 2555b8b413
commit 5c1ed12d8d
389 changed files with 1228 additions and 1600 deletions

View File

@@ -7,11 +7,12 @@
package grpcpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
@@ -134,11 +135,13 @@ func file_noop_proto_rawDescGZIP() []byte {
return file_noop_proto_rawDescData
}
var file_noop_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_noop_proto_goTypes = []any{
(*NoopRequest)(nil), // 0: io.podman.v1.NoopRequest
(*NoopResponse)(nil), // 1: io.podman.v1.NoopResponse
}
var (
file_noop_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
file_noop_proto_goTypes = []any{
(*NoopRequest)(nil), // 0: io.podman.v1.NoopRequest
(*NoopResponse)(nil), // 1: io.podman.v1.NoopResponse
}
)
var file_noop_proto_depIdxs = []int32{
0, // 0: io.podman.v1.Noop.Noop:input_type -> io.podman.v1.NoopRequest
1, // 1: io.podman.v1.Noop.Noop:output_type -> io.podman.v1.NoopResponse

View File

@@ -8,6 +8,7 @@ package grpcpb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"

View File

@@ -4,13 +4,12 @@ package compat
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
"strings"
"errors"
"github.com/containers/podman/v6/libpod"
"github.com/containers/podman/v6/libpod/define"
"github.com/containers/podman/v6/pkg/api/handlers/utils"

View File

@@ -281,7 +281,7 @@ func processBuildContext(query url.Values, r *http.Request, buildContext *BuildC
}
} else {
if dockerFile := query.Get("dockerfile"); dockerFile != "" {
var m = []string{}
m := []string{}
if err := json.Unmarshal([]byte(dockerFile), &m); err != nil {
// it's not json, assume just a string
m = []string{dockerFile}
@@ -322,8 +322,8 @@ func processBuildContext(query url.Values, r *http.Request, buildContext *BuildC
// processSecrets processes build secrets for podman-remote operations.
// Moves secrets outside build context to prevent accidental inclusion in images.
func processSecrets(query *BuildQuery, contextDirectory string, queryValues url.Values) ([]string, error) {
var secrets = []string{}
var m = []string{}
secrets := []string{}
m := []string{}
if err := utils.ParseOptionalJSONField(query.Secrets, "secrets", queryValues, &m); err != nil {
return nil, err
}
@@ -492,25 +492,25 @@ func createBuildOptions(query *BuildQuery, buildCtx *BuildContext, queryValues u
}
// Process build args
var buildArgs = map[string]string{}
buildArgs := map[string]string{}
if err := utils.ParseOptionalJSONField(query.BuildArgs, "buildargs", queryValues, &buildArgs); err != nil {
return nil, nil, utils.GetBadRequestError("buildargs", query.BuildArgs, err)
}
// Process excludes
var excludes = []string{}
excludes := []string{}
if err := utils.ParseOptionalJSONField(query.Excludes, "excludes", queryValues, &excludes); err != nil {
return nil, nil, utils.GetBadRequestError("excludes", query.Excludes, err)
}
// Process annotations
var annotations = []string{}
annotations := []string{}
if err := utils.ParseOptionalJSONField(query.Annotations, "annotations", queryValues, &annotations); err != nil {
return nil, nil, utils.GetBadRequestError("annotations", query.Annotations, err)
}
// Process CPP flags
var cppflags = []string{}
cppflags := []string{}
if err := utils.ParseOptionalJSONField(query.CPPFlags, "cppflags", queryValues, &cppflags); err != nil {
return nil, nil, utils.GetBadRequestError("cppflags", query.CPPFlags, err)
}
@@ -529,7 +529,7 @@ func createBuildOptions(query *BuildQuery, buildCtx *BuildContext, queryValues u
}
// Process labels
var labels = []string{}
labels := []string{}
if _, found := queryValues["labels"]; found {
makeLabels := make(map[string]string)
err := json.Unmarshal([]byte(query.Labels), &makeLabels)
@@ -565,7 +565,7 @@ func createBuildOptions(query *BuildQuery, buildCtx *BuildContext, queryValues u
}
} else {
// handle security-opt
var securityOpts = []string{}
securityOpts := []string{}
if err := utils.ParseOptionalJSONField(query.SecurityOpt, "securityopt", queryValues, &securityOpts); err != nil {
return nil, nil, utils.GetBadRequestError("securityopt", query.SecurityOpt, err)
}
@@ -592,7 +592,7 @@ func createBuildOptions(query *BuildQuery, buildCtx *BuildContext, queryValues u
}
// Process ulimits
var ulimits = []string{}
ulimits := []string{}
if err := utils.ParseOptionalJSONField(query.Ulimits, "ulimits", queryValues, &ulimits); err != nil {
return nil, nil, utils.GetBadRequestError("ulimits", query.Ulimits, err)
}
@@ -674,7 +674,7 @@ func createBuildOptions(query *BuildQuery, buildCtx *BuildContext, queryValues u
}
if _, found := r.URL.Query()["sbom-scanner-command"]; found {
var m = []string{}
m := []string{}
if err := json.Unmarshal([]byte(query.SBOMCommands), &m); err != nil {
return nil, cleanup, utils.GetBadRequestError("sbom-scanner-command", query.SBOMCommands, err)
}

View File

@@ -208,7 +208,7 @@ func getFdCount() (count int) {
if entries, err := os.ReadDir("/proc/self/fd"); err == nil {
count = len(entries)
}
return
return count
}
// Just ignoring Container errors here...

View File

@@ -4,11 +4,10 @@ package libpod
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"errors"
"github.com/containers/podman/v6/libpod"
"github.com/containers/podman/v6/libpod/define"
"github.com/containers/podman/v6/pkg/api/handlers/utils"

View File

@@ -13,9 +13,7 @@ import (
"go.podman.io/storage"
)
var (
ErrLinkNotSupport = errors.New("link is not supported")
)
var ErrLinkNotSupport = errors.New("link is not supported")
// TODO: document the exported functions in this file and make them more
// generic (e.g., not tied to one ctr/pod).

View File

@@ -99,6 +99,7 @@ func (w *BufferedResponseWriter) Flush() {
wrapped.Flush()
}
}
func newBufferedResponseWriter(rw http.ResponseWriter) *BufferedResponseWriter {
return &BufferedResponseWriter{
bufio.NewWriterSize(rw, 8192),