Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Jan 29, 2024
1 parent eab3580 commit 1a90f7a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions x/data/iri.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1a90f7a

Please sign in to comment.