fix code style issues reported by golint

This commit is contained in:
Wenkai Yin 2017-09-19 17:16:54 +08:00
parent 9c6468f963
commit f0946b63cf
5 changed files with 10 additions and 29 deletions

View File

@ -115,9 +115,5 @@ func (c *cfgStore) Write(config map[string]interface{}) error {
return err
}
if err = ioutil.WriteFile(c.path, b, 0600); err != nil {
return err
}
return nil
return ioutil.WriteFile(c.path, b, 0600)
}

View File

@ -267,8 +267,5 @@ func deleteRepository(name string) error {
}
func clearRepositoryData() error {
if err := ClearTable(models.RepoTable); err != nil {
return err
}
return nil
return ClearTable(models.RepoTable)
}

View File

@ -42,11 +42,7 @@ func (s *sqlite) Register(alias ...string) error {
if len(alias) != 0 {
an = alias[0]
}
if err := orm.RegisterDataBase(an, "sqlite3", s.file); err != nil {
return err
}
return nil
return orm.RegisterDataBase(an, "sqlite3", s.file)
}
// Name returns the name of SQLite

View File

@ -15,6 +15,10 @@ package job
import (
"fmt"
"os"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/vmware/harbor/src/common"
"github.com/vmware/harbor/src/common/dao"
@ -22,9 +26,6 @@ import (
"github.com/vmware/harbor/src/common/utils/log"
"github.com/vmware/harbor/src/common/utils/test"
"github.com/vmware/harbor/src/jobservice/config"
"os"
"strconv"
"testing"
)
var repJobID, scanJobID int64
@ -192,10 +193,7 @@ func clearRepJobData() error {
if err := dao.ClearTable(models.RepPolicyTable); err != nil {
return err
}
if err := dao.ClearTable(models.RepTargetTable); err != nil {
return err
}
return nil
return dao.ClearTable(models.RepTargetTable)
}
func prepareScanJobData() error {
@ -220,8 +218,5 @@ func clearScanJobData() error {
if err := dao.ClearTable(models.ScanJobTable); err != nil {
return err
}
if err := dao.ClearTable(models.ScanOverviewTable); err != nil {
return err
}
return nil
return dao.ClearTable(models.ScanOverviewTable)
}

View File

@ -357,10 +357,7 @@ func validate(user models.User) error {
if isIllegalLength(user.Password, 8, 20) {
return fmt.Errorf("password with illegal length")
}
if err := commonValidate(user); err != nil {
return err
}
return nil
return commonValidate(user)
}
//commonValidate validates email, realname, comment information when user register or change their profile