mirror of
https://github.com/containers/podman.git
synced 2025-09-06 22:37:37 +00:00
linter: enable makezero
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@@ -39,7 +39,6 @@ linters:
|
||||
- gofumpt
|
||||
- gci
|
||||
- godot
|
||||
- makezero
|
||||
- dupl
|
||||
- funlen
|
||||
- gochecknoglobals
|
||||
|
@@ -1149,7 +1149,7 @@ func (c *Container) inspectJoinedNetworkNS(networkns string) (q types.StatusBloc
|
||||
// result
|
||||
func resultToBasicNetworkConfig(result types.StatusBlock) (define.InspectBasicNetworkConfig, error) {
|
||||
config := define.InspectBasicNetworkConfig{}
|
||||
interfaceNames := make([]string, len(result.Interfaces))
|
||||
interfaceNames := make([]string, 0, len(result.Interfaces))
|
||||
for interfaceName := range result.Interfaces {
|
||||
interfaceNames = append(interfaceNames, interfaceName)
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ func PruneImages(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
idr := make([]types.ImageDeleteResponseItem, len(imagePruneReports))
|
||||
idr := make([]types.ImageDeleteResponseItem, 0, len(imagePruneReports))
|
||||
var reclaimedSpace uint64
|
||||
var errorMsg bytes.Buffer
|
||||
for _, p := range imagePruneReports {
|
||||
|
2
pkg/env/env.go
vendored
2
pkg/env/env.go
vendored
@@ -26,7 +26,7 @@ func DefaultEnvVariables() map[string]string {
|
||||
// Slice transforms the specified map of environment variables into a
|
||||
// slice. If a value is non-empty, the key and value are joined with '='.
|
||||
func Slice(m map[string]string) []string {
|
||||
env := make([]string, len(m))
|
||||
env := make([]string, 0, len(m))
|
||||
for k, v := range m {
|
||||
var s string
|
||||
if len(v) > 0 {
|
||||
|
@@ -579,9 +579,9 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
|
||||
// if CanonicalizeBytes needed more space than our slice provided, we may need to allocate again so use
|
||||
// append
|
||||
result = result[:1]
|
||||
result = append(result, number...)
|
||||
result = append(result, suffix...)
|
||||
result = append(result, '"')
|
||||
result = append(result, number...) // nolint: makezero
|
||||
result = append(result, suffix...) // nolint: makezero
|
||||
result = append(result, '"') // nolint: makezero
|
||||
return result, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user