github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/depsfile/testing.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package depsfile
     5  
     6  import (
     7  	"github.com/google/go-cmp/cmp"
     8  )
     9  
    10  // ProviderLockComparer is an option for github.com/google/go-cmp/cmp that
    11  // specifies how to compare values of type depsfile.ProviderLock.
    12  //
    13  // Use this, rather than crafting comparison options yourself, in case the
    14  // comparison strategy needs to change in future due to implementation details
    15  // of the ProviderLock type.
    16  var ProviderLockComparer cmp.Option
    17  
    18  func init() {
    19  	// For now, direct comparison of the unexported fields is good enough
    20  	// because we store everything in a normalized form. If that changes
    21  	// later then we might need to write a custom transformer to a hidden
    22  	// type with exported fields, so we can retain the ability for cmp to
    23  	// still report differences deeply.
    24  	ProviderLockComparer = cmp.AllowUnexported(ProviderLock{})
    25  }