Skip to content

Commit d238988

Browse files
mbgowen-mc
andauthored
Apply suggestions from code review
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
1 parent d079671 commit d238988

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

go/extractor/diagnostics/diagnostics.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,11 @@ func EmitExtractionFailedForProjects(path []string) {
570570
}
571571

572572
func EmitPrivateRegistryUsed(writer DiagnosticsWriter, configs []string) {
573-
lines := []string{}
573+
n := len(configs)
574+
lines := [n]string{}
574575

575576
for i := range configs {
576-
lines = append(lines, fmt.Sprintf("* %s", configs[i]))
577+
lines[i] = fmt.Sprintf("* %s", configs[i])
577578
}
578579

579580
emitDiagnosticTo(
@@ -582,7 +583,7 @@ func EmitPrivateRegistryUsed(writer DiagnosticsWriter, configs []string) {
582583
"Go extraction used private package registries",
583584
fmt.Sprintf(
584585
"Go was extracted using the following private package registr%s:\n\n%s\n",
585-
plural(len(lines), "y", "ies"),
586+
plural(n, "y", "ies"),
586587
strings.Join(lines, "\n")),
587588
severityNote,
588589
fullVisibility,

go/extractor/registries/registryproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func getEnvVars() []string {
112112
if err != nil {
113113
slog.Error("Unable to parse proxy configurations", slog.String("error", err.Error()))
114114
} else {
115-
activeConfigs := []RegistryConfig{}
115+
activeConfigs := make([]RegistryConfig{}, 0, len(val))
116116

117117
// We only care about private registry configurations that are relevant to Go and
118118
// filter others out at this point.

0 commit comments

Comments
 (0)