mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 01:29:07 +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
|
// OutputTypes returns a list of the valid output types
|
||||||
func OutputTypes() []string {
|
func OutputTypes() []string {
|
||||||
ts := []string{}
|
var ts []string
|
||||||
for k := range streamable {
|
for k := range streamable {
|
||||||
ts = append(ts, k)
|
ts = append(ts, k)
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ func mergeStrings(v1, v2 *[]string) *[]string {
|
|||||||
return v2
|
return v2
|
||||||
}
|
}
|
||||||
// merge the two uniquely
|
// merge the two uniquely
|
||||||
ret := []string{}
|
var ret []string
|
||||||
m := make(map[string]bool)
|
m := make(map[string]bool)
|
||||||
for _, s := range *v1 {
|
for _, s := range *v1 {
|
||||||
if m[s] {
|
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)
|
return oci, runtime, fmt.Errorf("Cannot parse tmpfs, too many ':': %s", t)
|
||||||
}
|
}
|
||||||
dest := parts[0]
|
dest := parts[0]
|
||||||
opts := []string{}
|
var opts []string
|
||||||
if len(parts) == 2 {
|
if len(parts) == 2 {
|
||||||
opts = strings.Split(parts[1], ",")
|
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
|
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)
|
// net, ipc, and uts namespaces: default to not creating a new namespace (usually host namespace)
|
||||||
netNS := assignStringEmpty3("root", label.Net, yaml.Net)
|
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
|
boundingSet[capability] = true
|
||||||
}
|
}
|
||||||
bounding := []string{}
|
var bounding []string
|
||||||
for capability := range boundingSet {
|
for capability := range boundingSet {
|
||||||
bounding = append(bounding, capability)
|
bounding = append(bounding, capability)
|
||||||
}
|
}
|
||||||
@ -922,7 +922,7 @@ func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uin
|
|||||||
sort.Strings(bounding)
|
sort.Strings(bounding)
|
||||||
|
|
||||||
rlimitsString := assignStrings(label.Rlimits, yaml.Rlimits)
|
rlimitsString := assignStrings(label.Rlimits, yaml.Rlimits)
|
||||||
rlimits := []specs.POSIXRlimit{}
|
var rlimits []specs.POSIXRlimit
|
||||||
for _, limitString := range rlimitsString {
|
for _, limitString := range rlimitsString {
|
||||||
rs := strings.SplitN(limitString, ",", 3)
|
rs := strings.SplitN(limitString, ",", 3)
|
||||||
var limit string
|
var limit string
|
||||||
@ -993,7 +993,7 @@ func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uin
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return oci, runtime, err
|
return oci, runtime, err
|
||||||
}
|
}
|
||||||
additionalGroups := []uint32{}
|
var additionalGroups []uint32
|
||||||
for _, id := range agIf {
|
for _, id := range agIf {
|
||||||
ag, err := idNumeric(id, idMap)
|
ag, err := idNumeric(id, idMap)
|
||||||
if err != nil {
|
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.
|
// 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) {
|
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 {
|
for i, platform := range platformsToSearchForIndex {
|
||||||
osArchArr := strings.Split(platform, "/")
|
osArchArr := strings.Split(platform, "/")
|
||||||
|
@ -152,7 +152,7 @@ func runPacket(args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client := packngo.NewClient("", apiKey, nil)
|
client := packngo.NewClient("", apiKey, nil)
|
||||||
tags := []string{}
|
var tags []string
|
||||||
|
|
||||||
var dev *packngo.Device
|
var dev *packngo.Device
|
||||||
var err error
|
var err error
|
||||||
|
@ -624,7 +624,7 @@ func buildQemuForwardings(publishFlags multipleFlag) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildDockerForwardings(publishedPorts []string) ([]string, error) {
|
func buildDockerForwardings(publishedPorts []string) ([]string, error) {
|
||||||
pmap := []string{}
|
var pmap []string
|
||||||
for _, port := range publishedPorts {
|
for _, port := range publishedPorts {
|
||||||
s, err := NewPublishedPort(port)
|
s, err := NewPublishedPort(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -46,8 +46,7 @@ type ScalewayClient struct {
|
|||||||
func NewScalewayClient(accessKey, secretKey, zone, organizationID string) (*ScalewayClient, error) {
|
func NewScalewayClient(accessKey, secretKey, zone, organizationID string) (*ScalewayClient, error) {
|
||||||
log.Debugf("Connecting to Scaleway")
|
log.Debugf("Connecting to Scaleway")
|
||||||
|
|
||||||
scwOptions := []scw.ClientOption{}
|
var scwOptions []scw.ClientOption
|
||||||
|
|
||||||
if accessKey == "" || secretKey == "" {
|
if accessKey == "" || secretKey == "" {
|
||||||
config, err := scw.LoadConfig()
|
config, err := scw.LoadConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -141,7 +141,7 @@ func (f *flagOverEnvVarOverDefaultString) Set(value string) error {
|
|||||||
|
|
||||||
// Convert a multi-line string into an array of strings
|
// Convert a multi-line string into an array of strings
|
||||||
func splitLines(in string) []string {
|
func splitLines(in string) []string {
|
||||||
res := []string{}
|
var res []string
|
||||||
|
|
||||||
s := bufio.NewScanner(strings.NewReader(in))
|
s := bufio.NewScanner(strings.NewReader(in))
|
||||||
for s.Scan() {
|
for s.Scan() {
|
||||||
|
Loading…
Reference in New Issue
Block a user