config/shconf/shconf.go
func (c *Config) Set(key, value string) error {
	c.Lock()
	defer c.Unlock()

	if _, found := c.data[key]; !found {
		return ErrKey
	}

	separator := string(c.Separator())
	replAt := []file.ReplacerAtLine{
		{key + separator, separator + ".*", separator + value},
	}

	if err := file.ReplaceAtLine(c.filename, replAt); err != nil {
		return err
	}
	c.data[key] = value
	return nil
}
func (c *Config) Set(key, value string) error {
	c.Lock()
	defer c.Unlock()

	if _, found := c.data[key]; !found {
		return ErrKey
	}

	separator := string(c.Separator())
	replAt := []file.ReplacerAtLine{
		{key + separator, separator + ".*", separator + value},
	}

	if err := file.ReplaceAtLine(c.filename, replAt); err != nil {
		return err
	}
	c.data[key] = value
	return nil
}
func ( c * Config ) Set ( key , value string ) error { c . Lock ( ) defer c . Unlock ( ) if _ , found := c . data [ key ] ; ! found { return ErrKey } separator := string ( c . Separator ( ) ) replAt := [ ] file . ReplacerAtLine { { key + separator , separator + " " , separator + value } , } if err := file . ReplaceAtLine ( c . filename , replAt ) ; err != nil { return err } c . data [ key ] = value return nil }
// Set writes a new value for key.
Set writes a new value for key .