MCPcopy Index your code
hub / github.com/go-task/task / readNodeContent

Method readNodeContent

taskfile/reader.go:449–471  ·  view source on GitHub ↗
(ctx context.Context, node Node)

Source from the content-addressed store, hash-verified

447}
448
449func (r *Reader) readNodeContent(ctx context.Context, node Node) ([]byte, error) {
450 if node, isRemote := node.(RemoteNode); isRemote {
451 return r.readRemoteNodeContent(ctx, node)
452 }
453
454 // Read the Taskfile
455 b, err := node.Read()
456 if err != nil {
457 return nil, err
458 }
459
460 // If the given checksum doesn't match the sum pinned in the Taskfile
461 checksum := checksum(b)
462 if !node.Verify(checksum) {
463 return nil, &errors.TaskfileDoesNotMatchChecksum{
464 URI: node.Location(),
465 ExpectedChecksum: node.Checksum(),
466 ActualChecksum: checksum,
467 }
468 }
469
470 return b, nil
471}
472
473func (r *Reader) readRemoteNodeContent(ctx context.Context, node RemoteNode) ([]byte, error) {
474 cache := NewCacheNode(node, r.tempDir)

Callers 1

readNodeMethod · 0.95

Calls 6

readRemoteNodeContentMethod · 0.95
checksumFunction · 0.85
ReadMethod · 0.65
VerifyMethod · 0.65
LocationMethod · 0.65
ChecksumMethod · 0.65

Tested by

no test coverage detected