Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-block-format
Commits
7e576d41
Commit
7e576d41
authored
Oct 07, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed error from return type of blocks.NewBlock()
parent
a83b9037
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
14 deletions
+5
-14
blocks.go
blocks.go
+2
-2
blocks_test.go
blocks_test.go
+3
-12
No files found.
blocks.go
View file @
7e576d41
...
...
@@ -12,8 +12,8 @@ type Block struct {
}
// NewBlock creates a Block object from opaque data. It will hash the data.
func
NewBlock
(
data
[]
byte
)
(
*
Block
,
error
)
{
return
&
Block
{
Data
:
data
,
Multihash
:
u
.
Hash
(
data
)}
,
nil
func
NewBlock
(
data
[]
byte
)
*
Block
{
return
&
Block
{
Data
:
data
,
Multihash
:
u
.
Hash
(
data
)}
}
// Key returns the block's Multihash as a Key value.
...
...
blocks_test.go
View file @
7e576d41
...
...
@@ -6,20 +6,11 @@ func TestBlocksBasic(t *testing.T) {
// Test empty data
empty
:=
[]
byte
{}
_
,
err
:=
NewBlock
(
empty
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
NewBlock
(
empty
)
// Test nil case
_
,
err
=
NewBlock
(
nil
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
NewBlock
(
nil
)
// Test some data
_
,
err
=
NewBlock
([]
byte
(
"Hello world!"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
NewBlock
([]
byte
(
"Hello world!"
))
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment