mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Merge pull request #3844 from dgageot/nil-empty-slides
Prefer nil empty slices (src/cmd/linuxkit)
This commit is contained in:
commit
221cbf2d11
@ -72,7 +72,7 @@ var additions = map[string]addFun{
|
||||
|
||||
// OutputTypes returns a list of the valid output types
|
||||
func OutputTypes() []string {
|
||||
ts := []string{}
|
||||
var ts []string
|
||||
for k := range streamable {
|
||||
ts = append(ts, k)
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ func mergeStrings(v1, v2 *[]string) *[]string {
|
||||
return v2
|
||||
}
|
||||
// merge the two uniquely
|
||||
ret := []string{}
|
||||
var ret []string
|
||||
m := make(map[string]bool)
|
||||
for _, s := range *v1 {
|
||||
if m[s] {
|
||||
@ -768,7 +768,7 @@ func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uin
|
||||
return oci, runtime, fmt.Errorf("Cannot parse tmpfs, too many ':': %s", t)
|
||||
}
|
||||
dest := parts[0]
|
||||
opts := []string{}
|
||||
var opts []string
|
||||
if len(parts) == 2 {
|
||||
opts = strings.Split(parts[1], ",")
|
||||
}
|
||||
@ -830,7 +830,7 @@ func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uin
|
||||
return mountList[i].Destination < mountList[j].Destination
|
||||
})
|
||||
|
||||
namespaces := []specs.LinuxNamespace{}
|
||||
var namespaces []specs.LinuxNamespace
|
||||
|
||||
// net, ipc, and uts namespaces: default to not creating a new namespace (usually host namespace)
|
||||
netNS := assignStringEmpty3("root", label.Net, yaml.Net)
|
||||
@ -914,7 +914,7 @@ func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uin
|
||||
}
|
||||
boundingSet[capability] = true
|
||||
}
|
||||
bounding := []string{}
|
||||
var bounding []string
|
||||
for capability := range boundingSet {
|
||||
bounding = append(bounding, capability)
|
||||
}
|
||||
@ -922,7 +922,7 @@ func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uin
|
||||
sort.Strings(bounding)
|
||||
|
||||
rlimitsString := assignStrings(label.Rlimits, yaml.Rlimits)
|
||||
rlimits := []specs.POSIXRlimit{}
|
||||
var rlimits []specs.POSIXRlimit
|
||||
for _, limitString := range rlimitsString {
|
||||
rs := strings.SplitN(limitString, ",", 3)
|
||||
var limit string
|
||||
@ -993,7 +993,7 @@ func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uin
|
||||
if err != nil {
|
||||
return oci, runtime, err
|
||||
}
|
||||
additionalGroups := []uint32{}
|
||||
var additionalGroups []uint32
|
||||
for _, id := range agIf {
|
||||
ag, err := idNumeric(id, idMap)
|
||||
if err != nil {
|
||||
|
@ -25,7 +25,7 @@ var platformsToSearchForIndex = []string{
|
||||
|
||||
// PushManifest create a manifest that supports each of the provided platforms and push it out.
|
||||
func PushManifest(img string, auth dockertypes.AuthConfig) (hash string, length int, err error) {
|
||||
srcImages := []types.ManifestEntry{}
|
||||
var srcImages []types.ManifestEntry
|
||||
|
||||
for i, platform := range platformsToSearchForIndex {
|
||||
osArchArr := strings.Split(platform, "/")
|
||||
|
@ -152,7 +152,7 @@ func runPacket(args []string) {
|
||||
}
|
||||
|
||||
client := packngo.NewClient("", apiKey, nil)
|
||||
tags := []string{}
|
||||
var tags []string
|
||||
|
||||
var dev *packngo.Device
|
||||
var err error
|
||||
|
@ -624,7 +624,7 @@ func buildQemuForwardings(publishFlags multipleFlag) (string, error) {
|
||||
}
|
||||
|
||||
func buildDockerForwardings(publishedPorts []string) ([]string, error) {
|
||||
pmap := []string{}
|
||||
var pmap []string
|
||||
for _, port := range publishedPorts {
|
||||
s, err := NewPublishedPort(port)
|
||||
if err != nil {
|
||||
|
@ -46,8 +46,7 @@ type ScalewayClient struct {
|
||||
func NewScalewayClient(accessKey, secretKey, zone, organizationID string) (*ScalewayClient, error) {
|
||||
log.Debugf("Connecting to Scaleway")
|
||||
|
||||
scwOptions := []scw.ClientOption{}
|
||||
|
||||
var scwOptions []scw.ClientOption
|
||||
if accessKey == "" || secretKey == "" {
|
||||
config, err := scw.LoadConfig()
|
||||
if err != nil {
|
||||
|
@ -141,7 +141,7 @@ func (f *flagOverEnvVarOverDefaultString) Set(value string) error {
|
||||
|
||||
// Convert a multi-line string into an array of strings
|
||||
func splitLines(in string) []string {
|
||||
res := []string{}
|
||||
var res []string
|
||||
|
||||
s := bufio.NewScanner(strings.NewReader(in))
|
||||
for s.Scan() {
|
||||
|
Loading…
Reference in New Issue
Block a user