aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bug/bug.go8
-rw-r--r--commands/new.go5
-rw-r--r--tests/bug_test.go14
-rw-r--r--tests/operation_iterator_test.go6
4 files changed, 10 insertions, 23 deletions
diff --git a/bug/bug.go b/bug/bug.go
index 3632d6f2..4df6996c 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -34,9 +34,9 @@ type Bug struct {
}
// Create a new Bug
-func NewBug() (*Bug, error) {
+func NewBug() *Bug {
// No id yet
- return &Bug{}, nil
+ return &Bug{}
}
// Find an existing Bug matching a prefix
@@ -216,9 +216,9 @@ func (bug *Bug) Commit(repo repository.Repo) error {
// Write a Git tree referencing this blob
hash, err = repo.StoreTree([]repository.TreeEntry{
// the last pack of ops
- {repository.Blob, hash, OpsEntryName},
+ {ObjectType: repository.Blob, Hash: hash, Name: OpsEntryName},
// always the first pack of ops (might be the same)
- {repository.Blob, bug.rootPack, RootEntryName},
+ {ObjectType: repository.Blob, Hash: bug.rootPack, Name: RootEntryName},
})
if err != nil {
diff --git a/commands/new.go b/commands/new.go
index 09369fe4..63bd885c 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -44,10 +44,7 @@ func runNewBug(cmd *cobra.Command, args []string) error {
return err
}
- newBug, err := bug.NewBug()
- if err != nil {
- return err
- }
+ newBug := bug.NewBug()
createOp := operations.NewCreateOp(author, title, newMessage)
diff --git a/tests/bug_test.go b/tests/bug_test.go
index e0737d1c..fdda31b1 100644
--- a/tests/bug_test.go
+++ b/tests/bug_test.go
@@ -6,14 +6,11 @@ import (
)
func TestBugId(t *testing.T) {
- bug1, err := bug.NewBug()
- if err != nil {
- t.Error(err)
- }
+ bug1 := bug.NewBug()
bug1.Append(createOp)
- err = bug1.Commit(mockRepo)
+ err := bug1.Commit(mockRepo)
if err != nil {
t.Fatal(err)
@@ -23,10 +20,7 @@ func TestBugId(t *testing.T) {
}
func TestBugValidity(t *testing.T) {
- bug1, err := bug.NewBug()
- if err != nil {
- t.Error(err)
- }
+ bug1 := bug.NewBug()
if bug1.IsValid() {
t.Fatal("Empty bug should be invalid")
@@ -44,7 +38,7 @@ func TestBugValidity(t *testing.T) {
t.Fatal("Bug with multiple CreateOp should be invalid")
}
- err = bug1.Commit(mockRepo)
+ err := bug1.Commit(mockRepo)
if err != nil {
t.Fatal(err)
diff --git a/tests/operation_iterator_test.go b/tests/operation_iterator_test.go
index bcbcfb08..a03553dc 100644
--- a/tests/operation_iterator_test.go
+++ b/tests/operation_iterator_test.go
@@ -23,11 +23,7 @@ var (
func TestOpIterator(t *testing.T) {
- bug1, err := bug.NewBug()
-
- if err != nil {
- t.Fatal(err)
- }
+ bug1 := bug.NewBug()
bug1.Append(createOp)
bug1.Append(setTitleOp)