Fix GenerateFingerprint() and add ParseFingerprint(). #188

Merged
merged 3 commits into from Jan 8, 2016

Conversation

Projects
None yet
3 participants
Contributor

ericsnowcurrently commented Jan 8, 2016

This patch changes GenerateFingerprint to take a reader rather than bytes. This aligns better with how it will be used.

ParseFingerprint() is added to provide a roundtrip for Fingerprint.String(). This is useful when Fingerprint.String() is used to serialize. Then ParseFingerprint() can be used to deserialize.

resource/fingerprint_test.go
func (s *FingerprintSuite) TestGenerateFingerprint(c *gc.C) {
expected, _ := newFingerprint(c, "spamspamspam")
+ data := bytes.NewBufferString("spamspamspam")
@natefinch

natefinch Jan 8, 2016

Contributor

FYI, strings.NewReader is more appropriate here, it's the string->io.Reader that you're looking for.

Contributor

natefinch commented Jan 8, 2016

LGTM, though it'll break a bunch of stuff in our code... perhaps we don't actually use this until after the demo?

Contributor

ericsnowcurrently commented Jan 8, 2016

$$merge$$

Contributor

jujubot commented Jan 8, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-charm

jujubot added a commit that referenced this pull request Jan 8, 2016

Merge pull request #188 from ericsnowcurrently/resources-fingerprint-…
…reader

Fix GenerateFingerprint() and add ParseFingerprint().

This patch changes GenerateFingerprint to take a reader rather than bytes.  This aligns better with how it will be used.

ParseFingerprint() is added to provide a roundtrip for Fingerprint.String().  This is useful when Fingerprint.String() is used to serialize.  Then ParseFingerprint() can be used to deserialize.

@jujubot jujubot merged commit d42434b into juju:v6-unstable Jan 8, 2016

@ericsnowcurrently ericsnowcurrently deleted the ericsnowcurrently:resources-fingerprint-reader branch Jan 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment