]>
Commit | Line | Data |
---|---|---|
107c1cdb ND |
1 | package tfdiags |
2 | ||
3 | // diagnosticBase can be embedded in other diagnostic structs to get | |
4 | // default implementations of Severity and Description. This type also | |
5 | // has default implementations of Source and FromExpr that return no source | |
6 | // location or expression-related information, so embedders should generally | |
7 | // override those method to return more useful results where possible. | |
8 | type diagnosticBase struct { | |
9 | severity Severity | |
10 | summary string | |
11 | detail string | |
12 | } | |
13 | ||
14 | func (d diagnosticBase) Severity() Severity { | |
15 | return d.severity | |
16 | } | |
17 | ||
18 | func (d diagnosticBase) Description() Description { | |
19 | return Description{ | |
20 | Summary: d.summary, | |
21 | Detail: d.detail, | |
22 | } | |
23 | } | |
24 | ||
25 | func (d diagnosticBase) Source() Source { | |
26 | return Source{} | |
27 | } | |
28 | ||
29 | func (d diagnosticBase) FromExpr() *FromExpr { | |
30 | return nil | |
31 | } |