Beispiel #1
0
func parse(raw string, key, secret *string) error {
	fields, err := stringutil.SplitFieldsOptions(raw, ":", &stringutil.SplitOptions{ExactCount: 2})
	if err != nil {
		return err
	}
	*key = fields[0]
	*secret = fields[1]
	return nil
}
Beispiel #2
0
func (a *Account) Parse(raw string) error {
	fields, err := stringutil.SplitFieldsOptions(raw, ":", &stringutil.SplitOptions{ExactCount: 2})
	if err != nil {
		return err
	}
	a.Username = fields[0]
	a.Password = fields[1]
	return nil
}