2017-06-26 23:46:34 +02:00
|
|
|
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
2016-11-15 20:30:34 +01:00
|
|
|
|
|
|
|
package diag
|
|
|
|
|
|
|
|
// ID is a unique diagnostics identifier.
|
|
|
|
type ID int
|
|
|
|
|
|
|
|
// Diag is an instance of an error or warning generated by the compiler.
|
|
|
|
type Diag struct {
|
2018-01-29 21:25:19 +01:00
|
|
|
ID ID // a unique identifier for this diagnostic.
|
|
|
|
Message string // a human-friendly message for this diagnostic.
|
|
|
|
Raw bool // true if this diagnostic should not be formatted when displayed.
|
2016-11-15 20:30:34 +01:00
|
|
|
}
|
|
|
|
|
2017-02-23 03:53:36 +01:00
|
|
|
// Message returns an anonymous diagnostic message without any source or ID information.
|
2017-06-03 03:35:53 +02:00
|
|
|
func Message(msg string) *Diag {
|
|
|
|
return &Diag{Message: msg}
|
2017-02-23 03:53:36 +01:00
|
|
|
}
|
|
|
|
|
2017-11-21 02:38:09 +01:00
|
|
|
// RawMessage returns an anonymous diagnostic message without any source or ID information that will not be rendered
|
|
|
|
// with Sprintf.
|
2017-11-14 20:26:41 +01:00
|
|
|
func RawMessage(msg string) *Diag {
|
|
|
|
return &Diag{Message: msg, Raw: true}
|
|
|
|
}
|