Skip to content

Commit 007ef32

Browse files
committed
fmt:
1 parent d9904d9 commit 007ef32

9 files changed

Lines changed: 28 additions & 32 deletions

File tree

cmd/preflight/cli/convert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"strings"
88

99
"github.com/pkg/errors"
10+
"github.com/replicatedhq/troubleshoot/pkg/convert"
1011
"github.com/spf13/cobra"
1112
"github.com/spf13/viper"
12-
"github.com/replicatedhq/troubleshoot/pkg/convert"
1313
)
1414

1515
func ConvertCmd() *cobra.Command {
@@ -129,4 +129,4 @@ func runConvert(v *viper.Viper, inputFile, outputSpec, outputValues string) erro
129129
fmt.Printf(" preflight run %s --values %s\n", outputSpec, outputValues)
130130

131131
return nil
132-
}
132+
}

pkg/convert/v1beta3.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212

1313
// V1Beta2ToV1Beta3Result holds the conversion results
1414
type V1Beta2ToV1Beta3Result struct {
15-
TemplatedSpec string `yaml:"-"`
16-
ValuesFile string `yaml:"-"`
15+
TemplatedSpec string `yaml:"-"`
16+
ValuesFile string `yaml:"-"`
1717
Values map[string]interface{} `yaml:"-"`
1818
}
1919

@@ -134,9 +134,9 @@ func (c *v1beta3Converter) convert() (string, error) {
134134

135135
func (c *v1beta3Converter) initializeValues() {
136136
c.values["kubernetes"] = map[string]interface{}{
137-
"enabled": false,
138-
"minVersion": "1.20.0",
139-
"recommendedVersion": "1.22.0",
137+
"enabled": false,
138+
"minVersion": "1.20.0",
139+
"recommendedVersion": "1.22.0",
140140
}
141141

142142
c.values["storage"] = map[string]interface{}{
@@ -151,9 +151,9 @@ func (c *v1beta3Converter) initializeValues() {
151151
}
152152

153153
c.values["node"] = map[string]interface{}{
154-
"minMemoryGi": 8,
155-
"recommendedMemoryGi": 32,
156-
"minEphemeralGi": 40,
154+
"minMemoryGi": 8,
155+
"recommendedMemoryGi": 32,
156+
"minEphemeralGi": 40,
157157
"recommendedEphemeralGi": 100,
158158
}
159159

@@ -630,4 +630,3 @@ func (c *v1beta3Converter) setNestedValue(path string, value interface{}) {
630630

631631
current[parts[len(parts)-1]] = value
632632
}
633-

pkg/preflight/template_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func TestRender_V1Beta3_CLI_ValuesAndSetFlags(t *testing.T) {
212212
}
213213
}
214214
require.NotNil(t, clusterVersionAnalyzer, "cluster version analyzer should be present")
215-
215+
216216
// Check that our --set values are used in the rendered outcomes
217217
foundMinVersion := false
218218
foundRecommendedVersion := false
@@ -261,7 +261,7 @@ spec:
261261
vals := map[string]interface{}{}
262262
rendered, err := RenderWithHelmTemplate(invalidYaml, vals)
263263
require.NoError(t, err, "template rendering should succeed even with malformed YAML")
264-
264+
265265
// But loading the spec should fail due to invalid YAML structure
266266
_, err = loader.LoadSpecs(context.Background(), loader.LoadOptions{RawSpec: rendered, Strict: true})
267267
assert.Error(t, err, "loading malformed YAML should produce an error")

pkg/supportbundle/extract_license.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func ExtractLicenseFromBundle(bundlePath string) (string, string, error) {
5454

5555
// Process .yaml, .yml, and .json files
5656
if !strings.HasSuffix(header.Name, ".yaml") &&
57-
!strings.HasSuffix(header.Name, ".yml") &&
58-
!strings.HasSuffix(header.Name, ".json") {
57+
!strings.HasSuffix(header.Name, ".yml") &&
58+
!strings.HasSuffix(header.Name, ".json") {
5959
continue
6060
}
6161

@@ -158,7 +158,7 @@ func extractLicenseWithRegex(content string) string {
158158
`"licenseID":\s*"([a-zA-Z0-9]{20,30})"`,
159159
`"license_id":\s*"([a-zA-Z0-9]{20,30})"`,
160160
`"license":\s*"([a-zA-Z0-9]{20,30})"`,
161-
`licenseID: ([a-zA-Z0-9]{20,30})`, // YAML format without quotes
161+
`licenseID: ([a-zA-Z0-9]{20,30})`, // YAML format without quotes
162162
`\\nlicenseID: ([a-zA-Z0-9]{20,30})`, // With escaped newline
163163
}
164164

@@ -282,8 +282,8 @@ func ExtractAppSlugFromBundle(bundlePath string) (string, error) {
282282

283283
// Process .yaml, .yml, and .json files
284284
if !strings.HasSuffix(header.Name, ".yaml") &&
285-
!strings.HasSuffix(header.Name, ".yml") &&
286-
!strings.HasSuffix(header.Name, ".json") {
285+
!strings.HasSuffix(header.Name, ".yml") &&
286+
!strings.HasSuffix(header.Name, ".json") {
287287
continue
288288
}
289289

@@ -306,7 +306,7 @@ func ExtractAppSlugFromBundle(bundlePath string) (string, error) {
306306

307307
// Skip common Kubernetes configmaps
308308
if filename == "kube-root-ca.crt" || strings.HasPrefix(filename, "kube-") ||
309-
strings.HasPrefix(filename, "kotsadm-") {
309+
strings.HasPrefix(filename, "kotsadm-") {
310310
continue
311311
}
312312

@@ -327,7 +327,7 @@ func extractAppSlugFromContent(content string) string {
327327
`app_slug:\s*["']?([a-zA-Z0-9\-]+)["']?`,
328328
`"appSlug":\s*"([a-zA-Z0-9\-]+)"`,
329329
`"app_slug":\s*"([a-zA-Z0-9\-]+)"`,
330-
`appSlug: ([a-zA-Z0-9\-]+)`, // YAML format without quotes
330+
`appSlug: ([a-zA-Z0-9\-]+)`, // YAML format without quotes
331331
`\\nappSlug: ([a-zA-Z0-9\-]+)`, // With escaped newline
332332
}
333333

@@ -339,4 +339,4 @@ func extractAppSlugFromContent(content string) string {
339339
}
340340

341341
return ""
342-
}
342+
}

pkg/supportbundle/upload.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,3 @@ func UploadBundleAutoDetect(bundlePath string, providedLicenseID, providedAppSlu
8888
fmt.Printf("Successfully uploaded support bundle\n")
8989
return nil
9090
}
91-

pkg/updater/pkgmgr/homebrew.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import (
77
)
88

99
// HomebrewPackageManager detects if a binary was installed via Homebrew
10-
type HomebrewPackageManager struct{
10+
type HomebrewPackageManager struct {
1111
formula string
1212
}
1313

1414
var _ PackageManager = (*HomebrewPackageManager)(nil)
1515

1616
type homebrewInfoOutput struct {
1717
Installed []struct {
18-
Version string `json:"version"`
19-
InstalledOn bool `json:"installed_on_request"`
20-
LinkedKeg string `json:"linked_keg"`
18+
Version string `json:"version"`
19+
InstalledOn bool `json:"installed_on_request"`
20+
LinkedKeg string `json:"linked_keg"`
2121
} `json:"installed"`
2222
}
2323

@@ -71,4 +71,3 @@ func (h *HomebrewPackageManager) IsInstalled() (bool, error) {
7171
func (h *HomebrewPackageManager) UpgradeCommand() string {
7272
return fmt.Sprintf("brew upgrade %s", h.formula)
7373
}
74-

pkg/updater/pkgmgr/krew.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
// KrewPackageManager detects if a binary was installed via kubectl krew
10-
type KrewPackageManager struct{
10+
type KrewPackageManager struct {
1111
pluginName string
1212
}
1313

@@ -66,4 +66,3 @@ func (k *KrewPackageManager) IsInstalled() (bool, error) {
6666
func (k *KrewPackageManager) UpgradeCommand() string {
6767
return fmt.Sprintf("kubectl krew upgrade %s", k.pluginName)
6868
}
69-

pkg/updater/pkgmgr/pkgmgr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ type PackageManager interface {
88
UpgradeCommand() string
99
// Name returns the human-readable name of the package manager
1010
Name() string
11-
}
11+
}

pkg/updater/updater.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func CheckAndUpdate(ctx context.Context, o Options) error {
8686
// Check if installed via package manager - only show message if newer version exists
8787
if pkgMgr := detectPackageManager(o.BinaryName); pkgMgr != nil {
8888
if o.Printf != nil {
89-
o.Printf("A newer version (%s) is available. Please run: %s\n",
89+
o.Printf("A newer version (%s) is available. Please run: %s\n",
9090
latest, pkgMgr.UpgradeCommand())
9191
}
9292
return nil
@@ -277,7 +277,7 @@ func detectPackageManager(binaryName string) pkgmgr.PackageManager {
277277
// Map binary names to their package manager formula/plugin names
278278
formulaName := getHomebrewFormulaName(binaryName)
279279
pluginName := getKrewPluginName(binaryName)
280-
280+
281281
// List of package managers to check
282282
packageManagers := []pkgmgr.PackageManager{
283283
pkgmgr.NewHomebrewPackageManager(formulaName),

0 commit comments

Comments
 (0)