Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error as #458

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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