mirror of
https://github.com/restic/restic.git
synced 2025-03-13 09:20:52 +00:00
25 lines
369 B
Go
25 lines
369 B
Go
![]() |
package options
|
||
|
|
||
|
type SecretString struct {
|
||
|
s *string
|
||
|
}
|
||
|
|
||
|
func NewSecretString(s string) SecretString {
|
||
|
return SecretString{s: &s}
|
||
|
}
|
||
|
|
||
|
func (s SecretString) GoString() string {
|
||
|
return `"` + s.String() + `"`
|
||
|
}
|
||
|
|
||
|
func (s SecretString) String() string {
|
||
|
if len(*s.s) == 0 {
|
||
|
return ``
|
||
|
}
|
||
|
return `**redacted**`
|
||
|
}
|
||
|
|
||
|
func (s *SecretString) Unwrap() string {
|
||
|
return *s.s
|
||
|
}
|