Make golint happy. Fixes #21

This commit is contained in:
Leonel Quinteros
2018-05-29 12:46:11 -03:00
parent 7c73cc2975
commit 3c52f5c10b
4 changed files with 16 additions and 12 deletions

22
mo.go
View File

@@ -20,11 +20,15 @@ import (
)
const (
MoMagicLittleEndian = 0x950412de // MoMagicLittleEndian encoding
MoMagicBigEndian = 0xde120495 // MoMagicBigEndian encoding
// MoMagicLittleEndian encoding
MoMagicLittleEndian = 0x950412de
// MoMagicBigEndian encoding
MoMagicBigEndian = 0xde120495
EotSeparator = "\x04" // msgctxt and msgid separator
NulSeparator = "\x00" // msgid and msgstr separator
// EotSeparator msgctxt and msgid separator
EotSeparator = "\x04"
// NulSeparator msgid and msgstr separator
NulSeparator = "\x00"
)
/*
@@ -195,8 +199,8 @@ func (mo *Mo) Parse(buf []byte) {
return
// return fmt.Errorf("gettext: %v", err)
}
msgIdData := make([]byte, msgIDLen[i])
if _, err := r.Read(msgIdData); err != nil {
msgIDData := make([]byte, msgIDLen[i])
if _, err := r.Read(msgIDData); err != nil {
return
// return fmt.Errorf("gettext: %v", err)
}
@@ -211,10 +215,10 @@ func (mo *Mo) Parse(buf []byte) {
// return fmt.Errorf("gettext: %v", err)
}
if len(msgIdData) == 0 {
mo.addTranslation(msgIdData, msgStrData)
if len(msgIDData) == 0 {
mo.addTranslation(msgIDData, msgStrData)
} else {
mo.addTranslation(msgIdData, msgStrData)
mo.addTranslation(msgIDData, msgStrData)
}
}

3
po.go
View File

@@ -366,9 +366,8 @@ func (po *Po) pluralForm(n int) int {
/* Use the Germanic plural rule. */
if n == 1 {
return 0
} else {
return 1
}
return 1
}
return po.pluralforms.Eval(uint32(n))
}

View File

@@ -33,7 +33,7 @@ func (t *Translation) Get() string {
return t.ID
}
// Get returns the string of the plural translation
// GetN returns the string of the plural translation
func (t *Translation) GetN(n int) string {
// Look for Translation index
if _, ok := t.Trs[n]; ok {

View File

@@ -5,6 +5,7 @@
package gotext
// Translator interface is used by Locale and Po objects
type Translator interface {
ParseFile(f string)
Parse(buf []byte)