-
-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
data1 := []byte{0x00, 0x00} | ||
data2 := []byte{0x00} | ||
val, err := Unset(data1, data2) | ||
if err == nil || val != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just test the error here, the test of the val was only be done in the associated testcase.
data2 := []byte{0x00} | ||
val, err := Unset(data1, data2) | ||
if err == nil || val != nil { | ||
log.Println("Unset with two byte slices of different size needs to return an error and no value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't log the same text as the testcase. It's a example, not a test.
You need to show a possible usage in a example.
log.Println("Unset with two byte slices of different size needs to return an error and no value") | ||
} | ||
fmt.Printf("%x\n", val) | ||
// Output: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this function, you have 2 possible outputs, val is empty or err is empty.
You need to create 2 examples, ExampleUnset()
and ExampleUnset_error
(see https://blog.golang.org/examples - Example function names section)
import "fmt" | ||
import ( | ||
"fmt" | ||
"log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use log, keep it to fmt
For the |
@andri-de Since #hacktoberfest 2017 is close, will you try to finalize this pull-request? |
Closes #47