Skip to content

Commit eadf34f

Browse files
committed
fix apple runtime lint issues
1 parent 0f6b42d commit eadf34f

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

internal/utils/apple_analytics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func StartAppleAnalyticsForwarders(containerIDs []string) error {
112112
return err
113113
}
114114
pidPath := filepath.Join(pidDir, containerID+".pid")
115-
if err := os.WriteFile(pidPath, []byte(strconv.Itoa(pid)), 0644); err != nil {
115+
if err := os.WriteFile(pidPath, []byte(strconv.Itoa(pid)), 0600); err != nil {
116116
return errors.Errorf("failed to write apple analytics pid: %w", err)
117117
}
118118
}

internal/utils/apple_container.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func appleListVolumes(ctx context.Context) ([]VolumeInfo, error) {
244244
}
245245
result := make([]VolumeInfo, 0, len(records))
246246
for _, item := range records {
247-
result = append(result, VolumeInfo{Name: item.Name, Labels: item.Labels})
247+
result = append(result, VolumeInfo(item))
248248
}
249249
return result, nil
250250
}
@@ -415,7 +415,7 @@ func appleEnsureImage(ctx context.Context, imageName string) error {
415415
return runContainerCommand(ctx, io.Discard, io.Discard, "image", "pull", imageName)
416416
}
417417

418-
func buildAppleContainerArgs(ctx context.Context, config container.Config, hostConfig container.HostConfig, networkingConfig network.NetworkingConfig, containerName string, detach bool, remove bool) ([]string, error) {
418+
func buildAppleContainerArgs(ctx context.Context, config container.Config, hostConfig container.HostConfig, _ network.NetworkingConfig, containerName string, detach bool, remove bool) ([]string, error) {
419419
applyContainerLabels(&config)
420420
imageName := GetRegistryImageUrl(config.Image)
421421
if err := appleEnsureImage(ctx, imageName); err != nil {
@@ -446,11 +446,11 @@ func buildAppleContainerArgs(ctx context.Context, config container.Config, hostC
446446
if hostConfig.ReadonlyRootfs {
447447
args = append(args, "--read-only")
448448
}
449-
if hostConfig.Resources.NanoCPUs > 0 {
450-
args = append(args, "--cpus", strconv.FormatInt(hostConfig.Resources.NanoCPUs/1_000_000_000, 10))
449+
if hostConfig.NanoCPUs > 0 {
450+
args = append(args, "--cpus", strconv.FormatInt(hostConfig.NanoCPUs/1_000_000_000, 10))
451451
}
452-
if hostConfig.Resources.Memory > 0 {
453-
args = append(args, "--memory", strconv.FormatInt(hostConfig.Resources.Memory, 10))
452+
if hostConfig.Memory > 0 {
453+
args = append(args, "--memory", strconv.FormatInt(hostConfig.Memory, 10))
454454
}
455455
for path := range hostConfig.Tmpfs {
456456
args = append(args, "--tmpfs", path)

internal/utils/runtime.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func InspectContainer(ctx context.Context, containerId string) (ContainerInfo, e
219219
info.Status = resp.State.Status
220220
info.Running = resp.State.Running
221221
if resp.State.Health != nil {
222-
info.HealthStatus = string(resp.State.Health.Status)
222+
info.HealthStatus = resp.State.Health.Status
223223
}
224224
}
225225
if resp.NetworkSettings != nil {
@@ -370,7 +370,7 @@ func AssertServiceHealthy(ctx context.Context, containerId string) error {
370370
}
371371
return nil
372372
}
373-
if len(info.HealthStatus) > 0 && info.HealthStatus != string(types.Healthy) {
373+
if len(info.HealthStatus) > 0 && info.HealthStatus != types.Healthy {
374374
return errors.Errorf("%s container is not ready: %s", containerId, info.HealthStatus)
375375
}
376376
return nil

0 commit comments

Comments
 (0)