Skip to content
This repository has been archived by the owner on Mar 13, 2019. It is now read-only.

Support encoding of pointers as interface types #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stevenroose
Copy link

@stevenroose stevenroose commented Dec 15, 2016

This simple case did not work:

type I interface{}
type S struct {}

var value I
value = new(S)
// value is now an I with underlying type *S
asn1.Encode(value)
// > invalid Go type: *S

@stevenroose
Copy link
Author

stevenroose commented Dec 16, 2016

Hmm, I just noticed this breaks the tests involving *big.Int.

@stevenroose
Copy link
Author

stevenroose commented Dec 16, 2016

I just explicitly excluded *big.Int. Since this is the only exception that must be handled differently, I think it makes sense. It now also works for interfaces that represent *big.Ints.

Tests work and my case works too. I added an explicit extra test case for the situation.

@stevenroose stevenroose changed the title Recursively get underlying value for Interfaces and Pointers Support encoding of pointers as interface types Dec 16, 2016
@stevenroose
Copy link
Author

I pulled this in my master branch here https://github.com/stevenroose/asn1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant