Skip to content

Commit 1994f14

Browse files
fixing linting issues
1 parent b89493d commit 1994f14

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

flags/version.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package flags
22

33
import (
44
"encoding/json"
5+
"errors"
56
"flag"
67
"fmt"
78
"io"
@@ -38,12 +39,12 @@ func latestRelease(output *strings.Builder) error {
3839

3940
if flag.Lookup("test.v") == nil {
4041
if parsedURL.Scheme != "https" {
41-
err := fmt.Errorf("only HTTPS URLs are allowed for security reasons")
42+
err := errors.New("only HTTPS URLs are allowed for security reasons")
4243
fmt.Fprintln(output, err)
4344
return err
4445
}
4546
if parsedURL.Host != "api.github.com" {
46-
err := fmt.Errorf("url host is not allowed")
47+
err := errors.New("url host is not allowed")
4748
fmt.Fprintln(output, err)
4849
return err
4950
}

flags/version_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/digitalghost-dev/poke-cli/cmd/utils"
88
"github.com/digitalghost-dev/poke-cli/styling"
99
"github.com/stretchr/testify/assert"
10+
"github.com/stretchr/testify/require"
1011
)
1112

1213
func TestLatestVersionFlag(t *testing.T) {
@@ -52,9 +53,9 @@ func TestLatestVersionFlag(t *testing.T) {
5253
cleanOutput := styling.StripANSI(output)
5354

5455
if tt.expectedError {
55-
assert.Error(t, err, "Expected an error")
56+
require.Error(t, err, "Expected an error")
5657
} else {
57-
assert.NoError(t, err, "Expected no error")
58+
require.NoError(t, err, "Expected no error")
5859
}
5960

6061
assert.Equal(t, tt.expectedOutput, cleanOutput, "Output should match expected")

0 commit comments

Comments
 (0)