Skip to content

Commit

Permalink
Fix linting issues + add Go 1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Feb 15, 2021
1 parent 744ce30 commit a7c1995
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Lint and test
strategy:
matrix:
go-version: [1.13.x, 1.14.x]
go-version: [1.13.x, 1.14.x, 1.15.x]
platform: [macos-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
go.deanishe.net/env v0.5.1
go.deanishe.net/fuzzy v1.0.0
golang.org/x/text v0.3.3
golang.org/x/text v0.3.5
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
go.deanishe.net/env v0.5.1 h1:WiOncK5uJj8Um57Vj2dc1bq1lMN7fgRag9up7I3LZy0=
go.deanishe.net/env v0.5.1/go.mod h1:ihEYfDm0K0hq3f5ACTCQDrMTWxH9fTiA1lh1i0aMqm0=
go.deanishe.net/fuzzy v1.0.0 h1:3Qp6PCX0DLb9z03b5OHwAGsbRSkgJpSLncsiDdXDt4Y=
go.deanishe.net/fuzzy v1.0.0/go.mod h1:2yEEMfG7jWgT1s5EO0TteVWmx2MXFBRMr5cMm84bQNY=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand All @@ -35,5 +39,7 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 h1:AQkaJpH+/FmqRjmXZPELom5zIERYZfwTjnHpfoVMQEc=
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
4 changes: 2 additions & 2 deletions icons.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const (
// Indicates that Icon.Value is the path to an image file that should
// be used as the Item's icon.
IconTypeImage IconType = ""
// Icon.Value points to an object whose icon should be show in Alfred,
//e.g. combine with "/Applications/Safari.app" to show Safari's icon.
// Indicates that Icon.Value points to an object whose icon should be show
// in Alfred, e.g. combine with "/Applications/Safari.app" to show Safari's icon.
IconTypeFileIcon IconType = "fileicon"
// Indicates that Icon.Value is a UTI, e.g. "public.folder",
// which will give you the icon for a folder.
Expand Down
2 changes: 1 addition & 1 deletion magic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func TestMagicDefaults(t *testing.T) {
})
}

// TestMagicActions checks that magic actions are triggered by their queries.
func TestMagicActions(t *testing.T) {
tests := []struct {
in string
Expand All @@ -156,7 +157,6 @@ func TestMagicActions(t *testing.T) {
}{
{"workflow:tes", true, false},
{"workflow:test", false, true},
//{"workflow:test", true, false, true},
}

for _, td := range tests {
Expand Down
2 changes: 1 addition & 1 deletion update/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func NewSemVer(s string) (SemVer, error) {
s, pre = s[:i], s[i+1:]
}

parts := strings.SplitN(s, ".", -1)
parts := strings.Split(s, ".")
for len(parts) < 3 { // Pad version
parts = append(parts, "0")
}
Expand Down
24 changes: 0 additions & 24 deletions util/build/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,6 @@ func TestSymlinkOverwrite(t *testing.T) {
err := Symlink(li.link, li.target, true)
assert.Nil(t, err, "overwrite symlink")
}

/*
for _, td := range tests {
td := td
t.Run(fmt.Sprintf("link=%q, target=%q", td.link, td.target), func(t *testing.T) {
t.Parallel()
err := Symlink(td.link, td.target, td.relative)
if td.err {
assert.NotNil(t, err, "expected error")
return
}
assert.Nil(t, err, "unexpected error")
_, err = os.Stat(td.link)
require.Nil(t, err, "stat symlink failed")
p, err := filepath.EvalSymlinks(td.link)
require.Nil(t, err, "EvalSymlinks failed")
target, err := filepath.Abs(td.target)
require.Nil(t, err, "filepath.Abs failed")
assert.Equal(t, target, p, "unexpected symlink")
})
}
*/
})
}

Expand Down
2 changes: 1 addition & 1 deletion util/formatting.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func fold(s string) string {

// PrettyPath replaces $HOME with ~ in path
func PrettyPath(path string) string {
return strings.Replace(path, os.Getenv("HOME"), "~", -1)
return strings.ReplaceAll(path, os.Getenv("HOME"), "~")
}

// PadLeft pads str to length n by adding pad to its left.
Expand Down
5 changes: 3 additions & 2 deletions workflow_feedback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ func TestItemHelpers(t *testing.T) {
assert.Equal(t, x, js, "unexpected File item")
}

// TestNewFileItem verifies Item creation by Workflow.NewFileItem().
func TestNewFileItem(t *testing.T) {
t.Parallel()

var (
wf = New()
ipPath = filepath.Join(wf.Dir(), "info.plist")
ipShort = strings.Replace(ipPath, os.Getenv("HOME"), "~", -1)
ipShort = strings.ReplaceAll(ipPath, os.Getenv("HOME"), "~")

it = wf.NewFileItem(ipPath)
)
Expand All @@ -56,7 +57,7 @@ func TestNewFileItem(t *testing.T) {
assert.Equal(t, ipPath, it.icon.Value, "unexpected icon value")
}

// WarnEmpty adds an item
// TestWarnEmpty verifies Item creation by Workflow.WarnEmpty().
func TestWarnEmpty(t *testing.T) {
wf := New()
assert.Equal(t, 0, len(wf.Feedback.Items), "feedback not empty")
Expand Down

0 comments on commit a7c1995

Please sign in to comment.