Fix typos and run gofmt -s
MODIFY
internal/app.go
internal/app.go
@@ -103,13 +103,13 @@ func askForUsernameAndPassword() (*discordgo.Session, error) {
if inputError != nil {
log.Fatalf("Error reading your username (%s).\n", inputError.Error())
}
- name := string(nameAsBytes[:len(nameAsBytes)])
+ name := string(nameAsBytes[:])
passwordAsBytes, inputError := getpass.Get("Please input your password.\n")
if inputError != nil {
log.Fatalf("Error reading your username (%s).\n", inputError.Error())
}
- password := string(passwordAsBytes[:len(passwordAsBytes)])
+ password := string(passwordAsBytes[:])
return discordgo.New(name, password)
}
@@ -123,7 +123,7 @@ func askForToken() (*discordgo.Session, error) {
log.Fatalf("Error reading your token (%s).\n", inputError.Error())
}
- token := string(tokenAsBytes[:len(tokenAsBytes)])
+ token := string(tokenAsBytes[:])
if token == "" {
log.Println("An empty token is not valid, please try again.")

MODIFY
internal/ui/window.go
internal/ui/window.go
@@ -132,7 +132,7 @@ func NewWindow(discord *discordgo.Session) (*Window, error) {
channels, discordError := discord.GuildChannels(guild.ID)
if discordError != nil {
- window.ShowErrorDialog(fmt.Sprintf("An error occured while trying to receive the channels: %s", discordError.Error()))
+ window.ShowErrorDialog(fmt.Sprintf("An error occurred while trying to receive the channels: %s", discordError.Error()))
//TODO Is returning here a good idea?
return
}
@@ -146,7 +146,7 @@ func NewWindow(discord *discordgo.Session) (*Window, error) {
node.SetSelectedFunc(func() {
discordError := window.LoadChannel(channelToConnectTo)
if discordError != nil {
- errorMessage := fmt.Sprintf("An error occured while trying to load the channel '%s': %s", channelToConnectTo.Name, discordError.Error())
+ errorMessage := fmt.Sprintf("An error occurred while trying to load the channel '%s': %s", channelToConnectTo.Name, discordError.Error())
window.ShowErrorDialog(errorMessage)
return
}
@@ -743,7 +743,7 @@ func (window *Window) ShowErrorDialog(text string) {
previousFocus := window.app.GetFocus()
dialog := tview.NewModal()
- dialog.SetTitle("An error occured")
+ dialog.SetTitle("An error occurred")
dialog.SetText(text)
dialog.AddButtons([]string{"Okay"})

Fix typos and run gofmt -s