Skip to content

Commit

Permalink
Merge pull request #458 from noborus/fix-error-as
Browse files Browse the repository at this point in the history
Fix error as
  • Loading branch information
noborus authored Oct 23, 2023
2 parents 9a25a77 + 7435a44 commit 3ea2d57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,9 @@ func initConfig() {

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
fmt.Fprintln(os.Stderr, err)
var configNotFoundError *viper.ConfigFileNotFoundError
if !errors.As(err, &configNotFoundError) {
fmt.Fprintln(os.Stderr, "failed to read config file:", err)
return
}
}
Expand Down
19 changes: 6 additions & 13 deletions oviewer/input_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package oviewer

import (
"sync"
"testing"

"github.com/gdamore/tcell/v2"
Expand Down Expand Up @@ -117,7 +116,6 @@ func TestInput_keyEvent(t *testing.T) {

func Test_candidate_up(t *testing.T) {
type fields struct {
mux sync.Mutex
list []string
p int
}
Expand Down Expand Up @@ -145,11 +143,9 @@ func Test_candidate_up(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &candidate{
mux: tt.fields.mux,
list: tt.fields.list,
p: tt.fields.p,
}
c := searchCandidate()
c.list = tt.fields.list
c.p = tt.fields.p
if got := c.up(); got != tt.want {
t.Errorf("candidate.up() = %v, want %v", got, tt.want)
}
Expand All @@ -159,7 +155,6 @@ func Test_candidate_up(t *testing.T) {

func Test_candidate_down(t *testing.T) {
type fields struct {
mux sync.Mutex
list []string
p int
}
Expand Down Expand Up @@ -187,11 +182,9 @@ func Test_candidate_down(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &candidate{
mux: tt.fields.mux,
list: tt.fields.list,
p: tt.fields.p,
}
c := searchCandidate()
c.list = tt.fields.list
c.p = tt.fields.p
if got := c.down(); got != tt.want {
t.Errorf("candidate.down() = %v, want %v", got, tt.want)
}
Expand Down

0 comments on commit 3ea2d57

Please sign in to comment.