Run go fmt on various files

Seems that go fmt has changed behaviour since these files were last
checked in.  Changes are all cosmetic.
This commit is contained in:
Bryan Boreham
2020-12-30 17:12:27 +00:00
parent b438707a92
commit 18acfcefe1
7 changed files with 64 additions and 65 deletions

View File

@@ -213,7 +213,7 @@ func NewAWSCollector(config AWSCollectorConfig) (AWSCollector, error) {
}
func (c *awsCollector) flushLoop() {
for _ = range c.ticker.C {
for range c.ticker.C {
c.flushPending(context.Background())
}
}

View File

@@ -5171,7 +5171,7 @@ func (m *LinuxPodSandboxConfig) MarshalTo(dAtA []byte) (int, error) {
i += n7
}
if len(m.Sysctls) > 0 {
for k, _ := range m.Sysctls {
for k := range m.Sysctls {
dAtA[i] = 0x1a
i++
v := m.Sysctls[k]
@@ -5291,7 +5291,7 @@ func (m *PodSandboxConfig) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
for k := range m.Labels {
dAtA[i] = 0x32
i++
v := m.Labels[k]
@@ -5308,7 +5308,7 @@ func (m *PodSandboxConfig) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Annotations) > 0 {
for k, _ := range m.Annotations {
for k := range m.Annotations {
dAtA[i] = 0x3a
i++
v := m.Annotations[k]
@@ -5649,7 +5649,7 @@ func (m *PodSandboxStatus) MarshalTo(dAtA []byte) (int, error) {
i += n16
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
for k := range m.Labels {
dAtA[i] = 0x3a
i++
v := m.Labels[k]
@@ -5666,7 +5666,7 @@ func (m *PodSandboxStatus) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Annotations) > 0 {
for k, _ := range m.Annotations {
for k := range m.Annotations {
dAtA[i] = 0x42
i++
v := m.Annotations[k]
@@ -5711,7 +5711,7 @@ func (m *PodSandboxStatusResponse) MarshalTo(dAtA []byte) (int, error) {
i += n17
}
if len(m.Info) > 0 {
for k, _ := range m.Info {
for k := range m.Info {
dAtA[i] = 0x12
i++
v := m.Info[k]
@@ -5785,7 +5785,7 @@ func (m *PodSandboxFilter) MarshalTo(dAtA []byte) (int, error) {
i += n18
}
if len(m.LabelSelector) > 0 {
for k, _ := range m.LabelSelector {
for k := range m.LabelSelector {
dAtA[i] = 0x1a
i++
v := m.LabelSelector[k]
@@ -5874,7 +5874,7 @@ func (m *PodSandbox) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintApi(dAtA, i, uint64(m.CreatedAt))
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
for k := range m.Labels {
dAtA[i] = 0x2a
i++
v := m.Labels[k]
@@ -5891,7 +5891,7 @@ func (m *PodSandbox) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Annotations) > 0 {
for k, _ := range m.Annotations {
for k := range m.Annotations {
dAtA[i] = 0x32
i++
v := m.Annotations[k]
@@ -6550,7 +6550,7 @@ func (m *ContainerConfig) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
for k := range m.Labels {
dAtA[i] = 0x4a
i++
v := m.Labels[k]
@@ -6567,7 +6567,7 @@ func (m *ContainerConfig) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Annotations) > 0 {
for k, _ := range m.Annotations {
for k := range m.Annotations {
dAtA[i] = 0x52
i++
v := m.Annotations[k]
@@ -6904,7 +6904,7 @@ func (m *ContainerFilter) MarshalTo(dAtA []byte) (int, error) {
i += copy(dAtA[i:], m.PodSandboxId)
}
if len(m.LabelSelector) > 0 {
for k, _ := range m.LabelSelector {
for k := range m.LabelSelector {
dAtA[i] = 0x22
i++
v := m.LabelSelector[k]
@@ -7015,7 +7015,7 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintApi(dAtA, i, uint64(m.CreatedAt))
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
for k := range m.Labels {
dAtA[i] = 0x42
i++
v := m.Labels[k]
@@ -7032,7 +7032,7 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Annotations) > 0 {
for k, _ := range m.Annotations {
for k := range m.Annotations {
dAtA[i] = 0x4a
i++
v := m.Annotations[k]
@@ -7200,7 +7200,7 @@ func (m *ContainerStatus) MarshalTo(dAtA []byte) (int, error) {
i += copy(dAtA[i:], m.Message)
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
for k := range m.Labels {
dAtA[i] = 0x62
i++
v := m.Labels[k]
@@ -7217,7 +7217,7 @@ func (m *ContainerStatus) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Annotations) > 0 {
for k, _ := range m.Annotations {
for k := range m.Annotations {
dAtA[i] = 0x6a
i++
v := m.Annotations[k]
@@ -7280,7 +7280,7 @@ func (m *ContainerStatusResponse) MarshalTo(dAtA []byte) (int, error) {
i += n43
}
if len(m.Info) > 0 {
for k, _ := range m.Info {
for k := range m.Info {
dAtA[i] = 0x12
i++
v := m.Info[k]
@@ -7912,7 +7912,7 @@ func (m *ImageStatusResponse) MarshalTo(dAtA []byte) (int, error) {
i += n51
}
if len(m.Info) > 0 {
for k, _ := range m.Info {
for k := range m.Info {
dAtA[i] = 0x12
i++
v := m.Info[k]
@@ -8331,7 +8331,7 @@ func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error) {
i += n58
}
if len(m.Info) > 0 {
for k, _ := range m.Info {
for k := range m.Info {
dAtA[i] = 0x12
i++
v := m.Info[k]
@@ -8606,7 +8606,7 @@ func (m *ContainerStatsFilter) MarshalTo(dAtA []byte) (int, error) {
i += copy(dAtA[i:], m.PodSandboxId)
}
if len(m.LabelSelector) > 0 {
for k, _ := range m.LabelSelector {
for k := range m.LabelSelector {
dAtA[i] = 0x1a
i++
v := m.LabelSelector[k]
@@ -8687,7 +8687,7 @@ func (m *ContainerAttributes) MarshalTo(dAtA []byte) (int, error) {
i += n64
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
for k := range m.Labels {
dAtA[i] = 0x1a
i++
v := m.Labels[k]
@@ -8704,7 +8704,7 @@ func (m *ContainerAttributes) MarshalTo(dAtA []byte) (int, error) {
}
}
if len(m.Annotations) > 0 {
for k, _ := range m.Annotations {
for k := range m.Annotations {
dAtA[i] = 0x22
i++
v := m.Annotations[k]
@@ -10741,7 +10741,7 @@ func (this *LinuxPodSandboxConfig) String() string {
return "nil"
}
keysForSysctls := make([]string, 0, len(this.Sysctls))
for k, _ := range this.Sysctls {
for k := range this.Sysctls {
keysForSysctls = append(keysForSysctls, k)
}
sortkeys.Strings(keysForSysctls)
@@ -10776,7 +10776,7 @@ func (this *PodSandboxConfig) String() string {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
for k := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
sortkeys.Strings(keysForLabels)
@@ -10786,7 +10786,7 @@ func (this *PodSandboxConfig) String() string {
}
mapStringForLabels += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations {
for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k)
}
sortkeys.Strings(keysForAnnotations)
@@ -10912,7 +10912,7 @@ func (this *PodSandboxStatus) String() string {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
for k := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
sortkeys.Strings(keysForLabels)
@@ -10922,7 +10922,7 @@ func (this *PodSandboxStatus) String() string {
}
mapStringForLabels += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations {
for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k)
}
sortkeys.Strings(keysForAnnotations)
@@ -10949,7 +10949,7 @@ func (this *PodSandboxStatusResponse) String() string {
return "nil"
}
keysForInfo := make([]string, 0, len(this.Info))
for k, _ := range this.Info {
for k := range this.Info {
keysForInfo = append(keysForInfo, k)
}
sortkeys.Strings(keysForInfo)
@@ -10980,7 +10980,7 @@ func (this *PodSandboxFilter) String() string {
return "nil"
}
keysForLabelSelector := make([]string, 0, len(this.LabelSelector))
for k, _ := range this.LabelSelector {
for k := range this.LabelSelector {
keysForLabelSelector = append(keysForLabelSelector, k)
}
sortkeys.Strings(keysForLabelSelector)
@@ -11012,7 +11012,7 @@ func (this *PodSandbox) String() string {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
for k := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
sortkeys.Strings(keysForLabels)
@@ -11022,7 +11022,7 @@ func (this *PodSandbox) String() string {
}
mapStringForLabels += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations {
for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k)
}
sortkeys.Strings(keysForAnnotations)
@@ -11196,7 +11196,7 @@ func (this *ContainerConfig) String() string {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
for k := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
sortkeys.Strings(keysForLabels)
@@ -11206,7 +11206,7 @@ func (this *ContainerConfig) String() string {
}
mapStringForLabels += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations {
for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k)
}
sortkeys.Strings(keysForAnnotations)
@@ -11331,7 +11331,7 @@ func (this *ContainerFilter) String() string {
return "nil"
}
keysForLabelSelector := make([]string, 0, len(this.LabelSelector))
for k, _ := range this.LabelSelector {
for k := range this.LabelSelector {
keysForLabelSelector = append(keysForLabelSelector, k)
}
sortkeys.Strings(keysForLabelSelector)
@@ -11364,7 +11364,7 @@ func (this *Container) String() string {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
for k := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
sortkeys.Strings(keysForLabels)
@@ -11374,7 +11374,7 @@ func (this *Container) String() string {
}
mapStringForLabels += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations {
for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k)
}
sortkeys.Strings(keysForAnnotations)
@@ -11423,7 +11423,7 @@ func (this *ContainerStatus) String() string {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
for k := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
sortkeys.Strings(keysForLabels)
@@ -11433,7 +11433,7 @@ func (this *ContainerStatus) String() string {
}
mapStringForLabels += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations {
for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k)
}
sortkeys.Strings(keysForAnnotations)
@@ -11467,7 +11467,7 @@ func (this *ContainerStatusResponse) String() string {
return "nil"
}
keysForInfo := make([]string, 0, len(this.Info))
for k, _ := range this.Info {
for k := range this.Info {
keysForInfo = append(keysForInfo, k)
}
sortkeys.Strings(keysForInfo)
@@ -11658,7 +11658,7 @@ func (this *ImageStatusResponse) String() string {
return "nil"
}
keysForInfo := make([]string, 0, len(this.Info))
for k, _ := range this.Info {
for k := range this.Info {
keysForInfo = append(keysForInfo, k)
}
sortkeys.Strings(keysForInfo)
@@ -11807,7 +11807,7 @@ func (this *StatusResponse) String() string {
return "nil"
}
keysForInfo := make([]string, 0, len(this.Info))
for k, _ := range this.Info {
for k := range this.Info {
keysForInfo = append(keysForInfo, k)
}
sortkeys.Strings(keysForInfo)
@@ -11910,7 +11910,7 @@ func (this *ContainerStatsFilter) String() string {
return "nil"
}
keysForLabelSelector := make([]string, 0, len(this.LabelSelector))
for k, _ := range this.LabelSelector {
for k := range this.LabelSelector {
keysForLabelSelector = append(keysForLabelSelector, k)
}
sortkeys.Strings(keysForLabelSelector)
@@ -11942,7 +11942,7 @@ func (this *ContainerAttributes) String() string {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
for k := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
sortkeys.Strings(keysForLabels)
@@ -11952,7 +11952,7 @@ func (this *ContainerAttributes) String() string {
}
mapStringForLabels += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations {
for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k)
}
sortkeys.Strings(keysForAnnotations)

View File

@@ -32,8 +32,8 @@ func dummyServer(t *testing.T, expectedToken, expectedID string, expectedVersion
t.Errorf("want %q, have %q", expectedVersion, have)
}
if have := r.Header.Get("user-agent"); "Scope_Probe/"+expectedVersion!=have {
t.Errorf("want %q, have %q","Scope_Probe/"+expectedVersion,have)
if have := r.Header.Get("user-agent"); "Scope_Probe/"+expectedVersion != have {
t.Errorf("want %q, have %q", "Scope_Probe/"+expectedVersion, have)
}
var have report.Report

View File

@@ -46,8 +46,7 @@ func (pc ProbeConfig) authorizeHeaders(headers http.Header) {
}
headers.Set(xfer.ScopeProbeIDHeader, pc.ProbeID)
headers.Set(xfer.ScopeProbeVersionHeader, pc.ProbeVersion)
headers.Set("user-agent","Scope_Probe/"+pc.ProbeVersion )
headers.Set("user-agent", "Scope_Probe/"+pc.ProbeVersion)
}

View File

@@ -121,13 +121,13 @@ func NewRegistry(options RegistryOptions) (Registry, error) {
images: map[string]docker_client.APIImages{},
pipeIDToexecID: map[string]string{},
client: client,
pipes: options.Pipes,
interval: options.Interval,
collectStats: options.CollectStats,
hostID: options.HostID,
handlerRegistry: options.HandlerRegistry,
quit: make(chan chan struct{}),
client: client,
pipes: options.Pipes,
interval: options.Interval,
collectStats: options.CollectStats,
hostID: options.HostID,
handlerRegistry: options.HandlerRegistry,
quit: make(chan chan struct{}),
noCommandLineArguments: options.NoCommandLineArguments,
noEnvironmentVariables: options.NoEnvironmentVariables,
}

View File

@@ -49,8 +49,8 @@ func servicePortString(p apiv1.ServicePort) string {
func (s *service) GetNode(probeID string) report.Node {
latest := map[string]string{
IP: s.Spec.ClusterIP,
Type: string(s.Spec.Type),
IP: s.Spec.ClusterIP,
Type: string(s.Spec.Type),
report.ControlProbeID: probeID,
}
if s.Spec.LoadBalancerIP != "" {

View File

@@ -241,13 +241,13 @@ var (
ServerContainerNodeID: report.MakeNodeWith(
ServerContainerNodeID, map[string]string{
docker.ContainerID: ServerContainerID,
docker.ContainerName: ServerContainerName,
docker.ContainerHostname: ServerContainerHostname,
docker.ContainerState: report.StateRunning,
docker.ContainerStateHuman: report.StateRunning,
docker.ImageID: ServerContainerImageID,
report.HostNodeID: ServerHostNodeID,
docker.ContainerID: ServerContainerID,
docker.ContainerName: ServerContainerName,
docker.ContainerHostname: ServerContainerHostname,
docker.ContainerState: report.StateRunning,
docker.ContainerStateHuman: report.StateRunning,
docker.ImageID: ServerContainerImageID,
report.HostNodeID: ServerHostNodeID,
docker.LabelPrefix + detailed.AmazonECSContainerNameLabel: "server",
docker.LabelPrefix + "foo1": "bar1",
docker.LabelPrefix + "foo2": "bar2",