func (m StringMap) Set(s string) error {
	if *m.Mapping == nil {
		*m.Mapping = map[string]string{}
	}
	// make a copy so the following code is less ugly with dereferencing.
	mapping := *m.Mapping

	// Note that gnuflag will prepend the bad argument to the error message, so
	// we don't need to restate it here.
	vals := strings.SplitN(s, "=", 2)
	if len(vals) != 2 {
		return errors.New("expected key=value format")
	}
	key, value := vals[0], vals[1]
	if len(key) == 0 || len(value) == 0 {
		return errors.New("key and value must be non-empty")
	}
	if _, ok := mapping[key]; ok {
		return errors.New("duplicate key specified")
	}
	mapping[key] = value
	return nil
}
// Set implements gnuflag.Value's Set method.
Set implements gnuflag.Value's Set method.
// Set implements gnuflag . Value ' s Set method .
func (m StringMap) Set(s string) error {
	if *m.Mapping == nil {
		*m.Mapping = map[string]string{}
	}
	mapping := *m.Mapping
	vals := strings.SplitN(s, "=", 2)
	if len(vals) != 2 {
		return errors.New("expected key=value format")
	}
	key, value := vals[0], vals[1]
	if len(key) == 0 || len(value) == 0 {
		return errors.New("key and value must be non-empty")
	}
	if _, ok := mapping[key]; ok {
		return errors.New("duplicate key specified")
	}
	mapping[key] = value
	return nil
}
func ( m StringMap ) Set ( s string ) error { if * m . Mapping == nil { * m . Mapping = map [ string ] string { } } mapping := * m . Mapping vals := strings . SplitN ( s , " " , 2 ) if len ( vals ) != 2 { return errors . New ( " " ) } key , value := vals [ 0 ] , vals [ 1 ] if len ( key ) == 0 || len ( value ) == 0 { return errors . New ( " " ) } if _ , ok := mapping [ key ] ; ok { return errors . New ( " " ) } mapping [ key ] = value return nil }
Set implements gnuflag.Value's Set method.
Set implements gnuflag . Value ' s Set method .
// make a copy so the following code is less ugly with dereferencing. // Note that gnuflag will prepend the bad argument to the error message, so // we don't need to restate it here.