Validate checks if only one field in the struct is non-nil.
()
| 343 | |
| 344 | // Validate checks if only one field in the struct is non-nil. |
| 345 | func (info LibraryInfo) Validate() error { |
| 346 | if info.LibName != nil && info.LibVer != nil { |
| 347 | return errors.New("both LibName and LibVer cannot be set at the same time") |
| 348 | } |
| 349 | if info.LibName == nil && info.LibVer == nil { |
| 350 | return errors.New("at least one of LibName and LibVer should be set") |
| 351 | } |
| 352 | return nil |
| 353 | } |
| 354 | |
| 355 | // Hello sets the resp protocol used. |
| 356 | func (c statefulCmdable) Hello(ctx context.Context, |
no outgoing calls