code: func (s Storage) UpdateSetting(c context.Context, key string, value json.RawMessage, who, why string) error {
  	c = defaultContext(c)
  
  	var fatalFail error // set in transaction on fatal errors
  	err := ds.RunInTransaction(c, func(c context.Context) error {
  		// Fetch the most recent values.
  		latest := latestSettings()
  		if err := ds.Get(c, &latest); err != nil && err != ds.ErrNoSuchEntity {
  			return err
  		}
  
  		// Update the value.
  		pairs := map[string]*json.RawMessage{}
  		if len(latest.Value) != 0 {
  			if err := json.Unmarshal([]byte(latest.Value), &pairs); err != nil {
  				fatalFail = err
  				return err
  			}
  		}
  		pairs[key] = &value
  
  		// Store the previous one in the log.
  		auditCopy := latest
  		auditCopy.Kind = "gaesettings.SettingsLog"
  		auditCopy.ID = strconv.Itoa(latest.Version)
  		auditCopy.Parent = ds.KeyForObj(c, &latest)
  
  		// Prepare a new version.
  		buf, err := json.MarshalIndent(pairs, "", "  ")
  		if err != nil {
  			fatalFail = err
  			return err
  		}
  		latest.Version++
  		latest.Value = string(buf)
  		latest.Who = who
  		latest.Why = why
  		latest.When = clock.Now(c).UTC()
  
  		// Skip update if no changes at all.
  		if latest.Value == auditCopy.Value {
  			return nil
  		}
  
  		// Don't store copy of "no settings at all", it's useless.
  		if latest.Version == 1 {
  			return ds.Put(c, &latest)
  		}
  		return ds.Put(c, &latest, &auditCopy)
  	}, nil)
  
  	if fatalFail != nil {
  		return fatalFail
  	}
  	return transient.Tag.Apply(err)
  }
docs: // UpdateSetting updates a setting at the given key.