Skip to content

Commit

Permalink
fix: typo and golint
Browse files Browse the repository at this point in the history
  • Loading branch information
sunggun-yu committed Feb 26, 2022
1 parent bcbcad3 commit db38f53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func useCommand() *cobra.Command {
}
// just exit if selected profile is already default
if profile.IsDefault {
cmd.Println("Profile", profile.Name, "is alreday set as default")
cmd.Println("Profile", profile.Name, "is already set as default")
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions internal/config/config_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func NewConfigFile(name string) (*ConfigFile, error) {
if name == "" {
return nil, fmt.Errorf("empty config file name")
}
// ensure if file is exsiting. if not create directory and file
// expand and replace file path if it is refering home dir, `~`, `$HOME`
// ensure if file is existing. if not create directory and file
// expand and replace file path if it is referring home dir, `~`, `$HOME`
p, err := util.EnsureConfigFilePath(filepath.Dir(name))
if err != nil {
return nil, err
Expand Down
10 changes: 5 additions & 5 deletions internal/config/config_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestConfigFile(t *testing.T) {

assert.NoError(err, "error should not occurred on read operation")

c.SetDefault(strconv.Itoa(n)) // it may not guarentee the order
c.SetDefault(strconv.Itoa(n)) // it may not guarantee the order
c.SetProfile(fmt.Sprintf("hello.world-%v", n), Profile{
Desc: strconv.Itoa(n),
Env: Envs{
Expand Down Expand Up @@ -115,7 +115,7 @@ func TestRead(t *testing.T) {

cf.config = nil
_, err := cf.Read()
assert.Error(err, "should occurr error when have wrong format of config file")
assert.Error(err, "should occur error when have wrong format of config file")
})
}

Expand All @@ -128,18 +128,18 @@ func TestWrite(t *testing.T) {
defer os.Remove(testFile) // remove file after testing
cf, _ := NewConfigFile(testFile)
err := cf.Save()
assert.Error(err, "should occurr error when have wrong format of config file")
assert.Error(err, "should occur error when have wrong format of config file")
})

t.Run("when have no permisson on config file", func(t *testing.T) {
t.Run("when have no permission on config file", func(t *testing.T) {
testFile := fmt.Sprintf("%v", GinkgoRandomSeed())
defer os.Remove(testFile) // remove file after testing
cf, _ := NewConfigFile(testFile)
cf.Read()
// make it read-only
os.Chmod(testFile, 0400)
err := cf.Save()
assert.Error(err, "should occurr error when have wrong format of config file")
assert.Error(err, "should occur error when have wrong format of config file")
})
}

Expand Down
6 changes: 3 additions & 3 deletions internal/prompt/confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"github.com/manifoldco/promptui"
)

// PromptYesOrNo prompts yes/no
// PromptConfirm prompts yes/no
type PromptConfirm struct {
prompt *promptui.Prompt
label string
}

// NewPromptConfirm
// NewPromptConfirm create new PromptConfirm
func NewPromptConfirm(label string) PromptConfirm {
return PromptConfirm{
label: label,
Expand Down Expand Up @@ -43,7 +43,7 @@ func (p *PromptConfirm) SetIn(in io.Reader) {
p.prompt.Stdin = io.NopCloser(in)
}

// PromptConfirm ask confirmation of y/N
// Prompt ask confirmation of y/N
func (p *PromptConfirm) Prompt() bool {
return p.run()
}

0 comments on commit db38f53

Please sign in to comment.