github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/resource/serialization.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package resource 5 6 import ( 7 "github.com/juju/errors" 8 "gopkg.in/juju/charm.v6-unstable/resource" 9 ) 10 11 // DeserializeFingerprint converts the serialized fingerprint back into 12 // a Fingerprint. "zero" values are treated appropriately. 13 func DeserializeFingerprint(fpSum []byte) (resource.Fingerprint, error) { 14 var fp resource.Fingerprint 15 if len(fpSum) != 0 { 16 var err error 17 fp, err = resource.NewFingerprint(fpSum) 18 if err != nil { 19 return fp, errors.Trace(err) 20 } 21 } 22 return fp, nil 23 }