Skip to content

Commit 8ad7813

Browse files
sebrandon1praveenkumar
authored andcommitted
address comments; bring back timeout and revive
1 parent da58588 commit 8ad7813

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+237
-240
lines changed

.golangci.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
version: "2"
22
run:
3+
timeout: 10m
34
build-tags:
45
- build
56
- containers_image_openpgp
@@ -9,28 +10,20 @@ linters:
910
- gosec
1011
- misspell
1112
- errcheck
12-
- gofmt
1313
- gosec
14-
- goimports
15-
# - revive # revive is flagging ginkgo and gomega dot-imports
14+
- revive
15+
disable:
16+
- dotimports
1617
exclusions:
1718
generated: lax
1819
presets:
1920
- comments
2021
- common-false-positives
2122
- legacy
2223
- std-error-handling
23-
paths:
24-
- third_party$
25-
- builtin$
26-
- examples$
2724
formatters:
2825
enable:
2926
- gofmt
3027
- goimports
3128
exclusions:
3229
generated: lax
33-
paths:
34-
- third_party$
35-
- builtin$
36-
- examples$

cmd/crc-embedder/cmd/embed.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ func embedFiles(executablePath string, filenames []string) error {
8888
logging.Debugf("Embedding %s in %s", filename, executablePath)
8989
f, err := os.Open(filename) // #nosec G304
9090
if err != nil {
91-
return fmt.Errorf("Failed to open %s: %v", filename, err)
91+
return fmt.Errorf("failed to open %s: %v", filename, err)
9292
}
9393
defer f.Close()
9494

9595
err = appender.AppendStreamReader(path.Base(filename), f, false)
9696
if err != nil {
97-
return fmt.Errorf("Failed to append %s to %s: %v", filename, executablePath, err)
97+
return fmt.Errorf("failed to append %s to %s: %v", filename, executablePath, err)
9898
}
9999
}
100100

cmd/crc/cmd/config/get.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ func configGetCmd(config config.Storage) *cobra.Command {
1616
Long: `Gets a crc configuration property.`,
1717
RunE: func(cmd *cobra.Command, args []string) error {
1818
if len(args) < 1 {
19-
return errors.New("Please provide a configuration property to get")
19+
return errors.New("please provide a configuration property to get")
2020
}
2121
key := args[0]
2222

2323
v := config.Get(key)
2424
if v.Invalid {
25-
return fmt.Errorf("Configuration property '%s' does not exist", key)
25+
return fmt.Errorf("configuration property '%s' does not exist", key)
2626
}
2727

2828
telemetry.SetConfigurationKey(cmd.Context(), args[0])

cmd/crc/cmd/config/set.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func configSetCmd(config *config.Config) *cobra.Command {
1717
CONFIG-KEYS: ` + "\n\n" + configurableFields(config),
1818
RunE: func(cmd *cobra.Command, args []string) error {
1919
if len(args) < 2 {
20-
return errors.New("Please provide a configuration property and its value as in 'crc config set KEY VALUE'")
20+
return errors.New("please provide a configuration property and its value as in 'crc config set KEY VALUE'")
2121
}
2222
setMessage, err := config.Set(args[0], args[1])
2323
if err != nil {

cmd/crc/cmd/config/unset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func configUnsetCmd(config config.Storage) *cobra.Command {
1616
Long: `Unsets a crc configuration property.`,
1717
RunE: func(cmd *cobra.Command, args []string) error {
1818
if len(args) != 1 {
19-
return errors.New("Please provide a configuration property to unset")
19+
return errors.New("please provide a configuration property to unset")
2020
}
2121
unsetMessage, err := config.Unset(args[0])
2222
if err != nil {

cmd/crc/cmd/console.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ func (s *consoleResult) prettyPrintTo(writer io.Writer) error {
9393
}
9494

9595
if s.state != state.Running {
96-
return errors.New("The OpenShift cluster is not running, cannot open the OpenShift Web Console")
96+
return errors.New("the OpenShift cluster is not running, cannot open the OpenShift Web Console")
9797
}
9898

9999
if _, err := fmt.Fprintln(writer, "Opening the OpenShift Web Console in the default browser..."); err != nil {
100100
return err
101101
}
102102
if err := browser.OpenURL(s.ClusterConfig.WebConsoleURL); err != nil {
103-
return fmt.Errorf("Failed to open the OpenShift Web Console, you can access it by opening %s in your web browser", s.ClusterConfig.WebConsoleURL)
103+
return fmt.Errorf("failed to open the OpenShift Web Console, you can access it by opening %s in your web browser", s.ClusterConfig.WebConsoleURL)
104104
}
105105

106106
return nil

cmd/crc/cmd/oc_env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var ocEnvCmd = &cobra.Command{
2424
func runOcEnv(_ []string) error {
2525
userShell, err := shell.GetShell(forceShell)
2626
if err != nil {
27-
return fmt.Errorf("Error running the oc-env command: %s", err.Error())
27+
return fmt.Errorf("error running the oc-env command: %s", err.Error())
2828
}
2929

3030
client := newMachine()

cmd/crc/cmd/podman_env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var podmanEnvCmd = &cobra.Command{
2525
func runPodmanEnv() error {
2626
userShell, err := shell.GetShell(forceShell)
2727
if err != nil {
28-
return fmt.Errorf("Error running the podman-env command: %s", err.Error())
28+
return fmt.Errorf("error running the podman-env command: %s", err.Error())
2929
}
3030

3131
client := newMachine()

pkg/compress/compress_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func checkFileList(destDir string, extractedFiles []string, expectedFiles fileMa
8484
}
8585
_, found := expectedFiles[rel]
8686
if !found {
87-
return fmt.Errorf("Unexpected file '%s' in file list %v", rel, expectedFiles)
87+
return fmt.Errorf("unexpected file '%s' in file list %v", rel, expectedFiles)
8888
}
8989
delete(expectedFiles, rel)
9090
}
@@ -117,7 +117,7 @@ func checkFiles(destDir string, files fileMap) error {
117117
}
118118
expectedContent, found := files[archivePath]
119119
if !found {
120-
return fmt.Errorf("Unexpected extracted file '%s'", path)
120+
return fmt.Errorf("unexpected extracted file '%s'", path)
121121
}
122122
delete(files, archivePath)
123123

@@ -126,7 +126,7 @@ func checkFiles(destDir string, files fileMap) error {
126126
return err
127127
}
128128
if string(data) != expectedContent {
129-
return fmt.Errorf("Unexpected content for '%s': expected [%s], got [%s]", path, expectedContent, string(data))
129+
return fmt.Errorf("unexpected content for '%s': expected [%s], got [%s]", path, expectedContent, string(data))
130130
}
131131
logging.Debugf("'%s' successfully checked", path)
132132
return nil

pkg/crc/api/api_http_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ var testCases = []testCase{
178178
{
179179
request: post("start"),
180180
failRequest: true,
181-
response: httpError(500).withBody("Failed to start\n"),
181+
response: httpError(500).withBody("failed to start\n"),
182182
},
183183
{
184184
request: get("start"),
185185
failRequest: true,
186-
response: httpError(500).withBody("Failed to start\n"),
186+
response: httpError(500).withBody("failed to start\n"),
187187
},
188188

189189
// stop

0 commit comments

Comments
 (0)