Don't generate default comment for local repos.

This commit is contained in:
Andrey Smirnov
2014-02-20 12:01:22 +04:00
parent c3819d6724
commit 8df4378f4c
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -23,9 +23,6 @@ type LocalRepo struct {
// NewLocalRepo creates new instance of Debian local repository
func NewLocalRepo(name string, comment string) *LocalRepo {
if comment == "" {
comment = "local repo"
}
return &LocalRepo{
UUID: uuid.New(),
Name: name,
@@ -35,7 +32,10 @@ func NewLocalRepo(name string, comment string) *LocalRepo {
// String interface
func (repo *LocalRepo) String() string {
return fmt.Sprintf("[%s]: %s", repo.Name, repo.Comment)
if repo.Comment != "" {
return fmt.Sprintf("[%s]: %s", repo.Name, repo.Comment)
}
return fmt.Sprintf("[%s]", repo.Name)
}
// NumPackages return number of packages in local repo
+1 -1
View File
@@ -33,7 +33,7 @@ func (s *LocalRepoSuite) TearDownTest(c *C) {
func (s *LocalRepoSuite) TestString(c *C) {
c.Check(NewLocalRepo("lrepo", "My first repo").String(), Equals, "[lrepo]: My first repo")
c.Check(NewLocalRepo("lrepo2", "").String(), Equals, "[lrepo2]: local repo")
c.Check(NewLocalRepo("lrepo2", "").String(), Equals, "[lrepo2]")
}
func (s *LocalRepoSuite) TestNumPackages(c *C) {