aboutsummaryrefslogtreecommitdiff
path: root/bencode
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-06-12 02:26:02 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-06-12 02:26:02 +0200
commit65d589e3ab2c8804ae241585e744bd7a7073e480 (patch)
tree77649192ab30e567a6e4eb6c264f59bf6373cca1 /bencode
parentd97f049cec6e470d5a2efaf2a85968fe141af6c8 (diff)
Unmarshal stub
Diffstat (limited to 'bencode')
-rw-r--r--bencode/bencode.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/bencode/bencode.go b/bencode/bencode.go
index d2d7815..f8e72ec 100644
--- a/bencode/bencode.go
+++ b/bencode/bencode.go
@@ -109,13 +109,17 @@ func marshalInt(out io.Writer, i int64) {
fmt.Fprintf(out, "i%de", i)
}
-func Unmarshal(data []byte, v interface{}) error {
- return nil
-}
-
func parseTag(tag string) (string, string) {
if i := strings.Index(tag, ","); i != -1 {
return tag[:i], tag[i+1:]
}
return tag, ""
}
+
+func Unmarshal(data []byte, v interface{}) error {
+ val := reflect.ValueOf(v)
+ if val.Kind() != reflect.Ptr {
+ return errors.New("non-pointer passed to Unmarshal")
+ }
+ return nil
+}