Fix golint warnings

This commit is contained in:
Tulir Asokan 2018-04-22 20:13:57 +03:00
parent adee1ffcc4
commit 7e946a0703
4 changed files with 9 additions and 10 deletions

View File

@ -66,10 +66,9 @@ func (config *Config) Load() {
os.MkdirAll(config.HistoryDir, 0700)
os.MkdirAll(config.MediaDir, 0700)
return
} else {
fmt.Println("Failed to read config from", configPath)
panic(err)
}
fmt.Println("Failed to read config from", configPath)
panic(err)
}
err = yaml.Unmarshal(data, &config)

View File

@ -21,7 +21,7 @@ import (
"maunium.net/go/gomuks/ui/messages/tstring"
)
// Message is a wrapper for the content and metadata of a Matrix message intended to be displayed.
// UIMessage is a wrapper for the content and metadata of a Matrix message intended to be displayed.
type UIMessage interface {
ifc.Message

View File

@ -35,7 +35,7 @@ func (ta *TagArray) Push(tag string) {
ta.PushMeta(&TagWithMeta{Tag: tag})
}
// Push adds the given tag to the array.
// PushMeta adds the given tag to the array.
func (ta *TagArray) PushMeta(tag *TagWithMeta) {
*ta = append(*ta, BlankTag)
copy((*ta)[1:], *ta)
@ -78,7 +78,7 @@ func (ta *TagArray) Get(tag string) *TagWithMeta {
return ta.GetAfter(tag, -1)
}
// IndexAfter returns the first occurrence of the given tag, or nil if the given
// GetAfter returns the first occurrence of the given tag, or nil if the given
// tag is not on the list after the given index.
func (ta *TagArray) GetAfter(tag string, after int) *TagWithMeta {
for i := after + 1; i < len(*ta); i++ {

View File

@ -241,7 +241,7 @@ type completion struct {
id string
}
func (view *RoomView) AutocompleteUser(existingText string) (completions []completion) {
func (view *RoomView) autocompleteUser(existingText string) (completions []completion) {
textWithoutPrefix := strings.TrimPrefix(existingText, "@")
for _, user := range view.Room.GetMembers() {
if user.DisplayName == textWithoutPrefix || user.UserID == existingText {
@ -256,7 +256,7 @@ func (view *RoomView) AutocompleteUser(existingText string) (completions []compl
return
}
func (view *RoomView) AutocompleteRoom(existingText string) (completions []completion) {
func (view *RoomView) autocompleteRoom(existingText string) (completions []completion) {
// TODO - This was harder than I expected.
return []completion{}
@ -270,8 +270,8 @@ func (view *RoomView) InputTabComplete(text string, cursorOffset int) {
var strCompletions []string
var strCompletion string
completions := view.AutocompleteUser(word)
completions = append(completions, view.AutocompleteRoom(word)...)
completions := view.autocompleteUser(word)
completions = append(completions, view.autocompleteRoom(word)...)
if len(completions) == 1 {
completion := completions[0]