Skip to content
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
3 changes: 2 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
linters:
version: "2"
formatters:
enable:
- gofumpt
4 changes: 2 additions & 2 deletions internal/cmd/config_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func TestNewConfigSetCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/create_env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func TestNewCreateEnvCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func TestNewCreateCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/edit_env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func TestNewEditEnvCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/edit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func TestNewEditCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func TestNewFixCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w := s.setup(t)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/global_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func newGlobalGetCmd(workspaceManager workspaceManager, completionManager comple
case "config-dir":
cmd.Printf("%s", workspaceManager.GetConfigDir())
default:
return fmt.Errorf("Key '%s' does not exist", args[0])
return fmt.Errorf("key '%s' does not exist", args[0])
}
return nil
},
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/global_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func TestNewGlobalGetCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func TestNewListCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/remove_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func TestNewRemoveCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
14 changes: 7 additions & 7 deletions internal/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func TestNewWorkspaceManager(t *testing.T) {
{
"Missing VISUAL or EDITOR variable",
func(t *testing.T) {
os.Unsetenv("VISUAL")
os.Unsetenv("EDITOR")
assert.NoError(t, os.Unsetenv("VISUAL"))
assert.NoError(t, os.Unsetenv("EDITOR"))
},
func(t *testing.T, w workspaceManager, err error) {
assert.Error(t, err)
Expand All @@ -27,8 +27,8 @@ func TestNewWorkspaceManager(t *testing.T) {
{
"Missing SHELL variable",
func(t *testing.T) {
os.Setenv("VISUAL", "emacs")
os.Unsetenv("SHELL")
assert.NoError(t, os.Setenv("VISUAL", "emacs"))
assert.NoError(t, os.Unsetenv("SHELL"))
},
func(t *testing.T, w workspaceManager, err error) {
assert.Error(t, err)
Expand All @@ -37,9 +37,9 @@ func TestNewWorkspaceManager(t *testing.T) {
{
"Customize the config directory",
func(t *testing.T) {
os.Setenv("VISUAL", "emacs")
os.Setenv("SHELL", "/bin/bash")
os.Setenv("WO_CONFIG_PATH", os.TempDir())
assert.NoError(t, os.Setenv("VISUAL", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/bash"))
assert.NoError(t, os.Setenv("WO_CONFIG_PATH", os.TempDir()))
},
func(t *testing.T, w workspaceManager, err error) {
assert.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func TestNewRunCmd(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
w, args := s.setup(t)
cmd := newRunCmd(w, newMockCompletionManager(t))
cmd.SetArgs(args)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ export WO_THEME=light
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w := s.setup(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ Envs
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.Setenv("EDITOR", "emacs")
os.Setenv("SHELL", "/bin/sh")
assert.NoError(t, os.Setenv("EDITOR", "emacs"))
assert.NoError(t, os.Setenv("SHELL", "/bin/sh"))
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
w, args := s.setup(t)
Expand Down
24 changes: 12 additions & 12 deletions internal/workspace/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestNewWorkspaceManager(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
visual, editor, shell := s.setup()
manager, err := NewWorkspaceManager(WithEditor(editor, visual), WithShellPath(shell), WithConfigPath(config.getPath(t)))
s.test(t, manager, err)
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestList(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
s.setup(t, w)
Expand Down Expand Up @@ -215,7 +215,7 @@ test_func2() {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
s.setup(t, w)
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestCreate(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
projectPath := s.setup(t, w)
Expand Down Expand Up @@ -350,7 +350,7 @@ func TestCreateEnv(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
assert.NoError(t, w.Create("test", project.getPath(t)))
Expand Down Expand Up @@ -385,7 +385,7 @@ func TestEdit(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
exec := NewMockCommander(t)
Expand Down Expand Up @@ -423,7 +423,7 @@ func TestEditEnv(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
err = w.Create("test", project.getPath(t))
Expand Down Expand Up @@ -513,7 +513,7 @@ end
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath(s.shell), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
err = w.Create("test", project.getPath(t))
Expand Down Expand Up @@ -568,7 +568,7 @@ func TestRemove(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
err = w.Create("test", project.getPath(t))
Expand Down Expand Up @@ -624,7 +624,7 @@ func TestFix(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
err = w.Create("test", project.getPath(t))
Expand Down Expand Up @@ -701,7 +701,7 @@ func TestSetConfig(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
err = w.Create("test", project.getPath(t))
Expand Down Expand Up @@ -734,7 +734,7 @@ func TestBuildAliases(t *testing.T) {
}
for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
os.RemoveAll(config.getPath(t))
assert.NoError(t, os.RemoveAll(config.getPath(t)))
w, err := NewWorkspaceManager(WithEditor("emacs", "emacs"), WithShellPath("/bin/bash"), WithConfigPath(config.getPath(t)))
assert.NoError(t, err)
testProjectPath := fmt.Sprintf("%s/test", project.getPath(t))
Expand Down
Loading