github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/command/jsonformat/differ/differ.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package differ
     5  
     6  import (
     7  	"github.com/terramate-io/tf/command/jsonformat/computed"
     8  	"github.com/terramate-io/tf/command/jsonformat/structured"
     9  )
    10  
    11  // asDiff is a helper function to abstract away some simple and common
    12  // functionality when converting a renderer into a concrete diff.
    13  func asDiff(change structured.Change, renderer computed.DiffRenderer) computed.Diff {
    14  	return computed.NewDiff(renderer, change.CalculateAction(), change.ReplacePaths.Matches())
    15  }