You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asn1 marshalling uses the forkableWriter, but unfortunately the
current code fails for any structures with more than one members.
To reproduce
type Foo struct { a,b int }
asn1.Marshal(os.Stdout, Foo{1,2})
only marshals the last field of Foo.
The following patch fixes this:
diff -r e73e37a4a6da src/pkg/asn1/marshal.go
--- a/src/pkg/asn1/marshal.go Sat Jan 09 09:47:45 2010 -0800
+++ b/src/pkg/asn1/marshal.go Mon Jan 11 14:49:11 2010 +0200
@@ -29,6 +29,7 @@
}
func (f *forkableWriter) fork() (pre, post *forkableWriter) {
+ for f.post != nil { f = f.post }
f.pre = newForkableWriter()
f.post = newForkableWriter()
return f.pre, f.post
@@ -61,7 +62,7 @@
}
}
- if f.pre != nil {
+ if f.post != nil {
nn, err = f.post.writeTo(out)
n += nn
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: