github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/tfdiags/diagnostic_base.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 package tfdiags 5 6 // diagnosticBase can be embedded in other diagnostic structs to get 7 // default implementations of Severity and Description. This type also 8 // has default implementations of Source and FromExpr that return no source 9 // location or expression-related information, so embedders should generally 10 // override those method to return more useful results where possible. 11 type diagnosticBase struct { 12 severity Severity 13 summary string 14 detail string 15 address string 16 } 17 18 func (d diagnosticBase) Severity() Severity { 19 return d.severity 20 } 21 22 func (d diagnosticBase) Description() Description { 23 return Description{ 24 Summary: d.summary, 25 Detail: d.detail, 26 Address: d.address, 27 } 28 } 29 30 func (d diagnosticBase) Source() Source { 31 return Source{} 32 } 33 34 func (d diagnosticBase) FromExpr() *FromExpr { 35 return nil 36 } 37 38 func (d diagnosticBase) ExtraInfo() interface{} { 39 return nil 40 }