From 1a90f7a410a10e9bb80dcabe1414747d68d6ed26 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 29 Jan 2024 12:54:03 -0500 Subject: [PATCH] lint --- x/data/iri.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/x/data/iri.go b/x/data/iri.go index f9bba6b333..fcada9b868 100644 --- a/x/data/iri.go +++ b/x/data/iri.go @@ -114,16 +114,16 @@ func ParseIRI(iri string) (*ContentHash, error) { hash := rdr.Bytes() - if version == iriVersion0 { - return &ContentHash{Raw: &ContentHash_Raw{ - Hash: hash, - DigestAlgorithm: uint32(b0), - FileExtension: ext, - }}, nil - } else { + if version != iriVersion0 { return nil, ErrInvalidIRI.Wrapf("failed to parse IRI %s: invalid version %d", iri, version) } + return &ContentHash{Raw: &ContentHash_Raw{ + Hash: hash, + DigestAlgorithm: uint32(b0), + FileExtension: ext, + }}, nil + case IriPrefixGraph: // rdf extension is expected for graph data if ext != "rdf" { @@ -151,16 +151,16 @@ func ParseIRI(iri string) (*ContentHash, error) { // read hash hash := rdr.Bytes() - if version == iriVersion0 { - return &ContentHash{Graph: &ContentHash_Graph{ - Hash: hash, - DigestAlgorithm: uint32(bDigestAlg), - CanonicalizationAlgorithm: uint32(bC14NAlg), - MerkleTree: uint32(bMtAlg), - }}, nil - } else { + if version != iriVersion0 { return nil, ErrInvalidIRI.Wrapf("failed to parse IRI %s: invalid version %d", iri, version) } + + return &ContentHash{Graph: &ContentHash_Graph{ + Hash: hash, + DigestAlgorithm: uint32(bDigestAlg), + CanonicalizationAlgorithm: uint32(bC14NAlg), + MerkleTree: uint32(bMtAlg), + }}, nil } return nil, ErrInvalidIRI.Wrapf("unable to parse IRI %s", iri)