~samwhited/xmpp

ref: d4b835bf2b08a22e6a13cd9b33e62c88f9854677 xmpp/internal/marshal d---------
internal/marshal: prevent duplicate xmlns attr

Encoding the output of TokenReader can create multiple xmlns attributes
due to a bug in encoding/xml.
This patch uses RawToken in the decode stage to work around this and can
be reverted after the upstream issue is fixed and in all supported
versions of Go.

Upstream issue: https://golang.org/issue/42807 (golang/go#42807)
Upstream CL: https://golang.org/cl/272806 (golang/go#42808)

Fixes #74

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: use data driven testing

Add tests for all branches using a table driven test to exercise
various error conditions.

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: return existing TokenReaders

Short circuit from marshal.TokenReader if the input is already a
TokenReader to avoid the overhead of re-encoding everything in this
niche special case.

See #38

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update BUG comments

Remove inaccurate BUG comments and update existing ones to contain a
link to their relavant issue so that they get removed if the issue is
closed.

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: add TokenReader API

While thinking about whether or not it would be difficult to add
EncodeIQ and EncodeIQElement methods to Session I realized that I
wouldn't be able to implement them in terms of SendIQ and SendIQ element
because these use a token reader based API as opposed to the token
writer based API used by the functions in Marshal. However, internally
the marshal functions create a token reader and then copy from it into
the writer, so by exposing this functionality we can make it possible to
create reader or writer based functionality with the marshal package.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: add missing canonical import comments

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: add package description
interal/marshal: add a few tests
all: move encoding funcs into internal/marshal
Next