// SaveWith saves the configuration using any marshaler at all.
342873
func SaveWith(path string, v interface{}, m MarshalFunc) error {
	if applicationName == "" {
		panic("store: application name not defined")
	}

	var b bytes.Buffer

	if data, err := m(v); err == nil {
		b.Write(data)
	} else {
		return fmt.Errorf("store: failed to marshal %s: %v", path, err)
	}

	b.WriteRune('\n')

	globalPath := buildPlatformPath(path)
	if err := os.MkdirAll(filepath.Dir(globalPath), os.ModePerm); err != nil {
		return err
	}

	if err := ioutil.WriteFile(globalPath, b.Bytes(), os.ModePerm); err != nil {
		return err
	}

	return nil
}
45027
func (w *wrapper) Save() error {
	w.mut.Lock()
	defer w.mut.Unlock()

	fd, err := osutil.CreateAtomic(w.path)
	if err != nil {
		l.Debugln("CreateAtomic:", err)
		return err
	}

	if err := w.cfg.WriteXML(fd); err != nil {
		l.Debugln("WriteXML:", err)
		fd.Close()
		return err
	}

	if err := fd.Close(); err != nil {
		l.Debugln("Close:", err)
		return err
	}

	events.Default.Log(events.ConfigSaved, w.cfg)
	return nil
}
405476
func WithOption(key, value string) func(*types.NetworkCreate) {
	return func(n *types.NetworkCreate) {
		if n.Options == nil {
			n.Options = map[string]string{}
		}
		n.Options[key] = value
	}
}
127564
func (c *ConfigFile) Save() error {
	rw, err := NewConfigReadWriter(c.version)
	if err != nil {
		return err
	}
	filename := rw.Filename(c)
	if filename == "" {
		return fmt.Errorf("Can't save config with empty filename")
	}
	if err := os.MkdirAll(filepath.Dir(filename), 0700); err != nil {
		return err
	}
	file, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
	if err != nil {
		return err
	}
	defer file.Close()
	return rw.SaveToWriter(file, c)
}
1346396
func saveJson(obj interface{}, fname string) (err error) {
  var data []byte
  data, err = json.Marshal(&obj)
  if err == nil {
    var buff bytes.Buffer
    err = json.Indent(&buff, data, " ", "  ")
    if err == nil {
      err = ioutil.WriteFile(fname, buff.Bytes(), 0600)
    }
  }
  return
}
641601
func WithWriter(a adaptor.Adaptor) OptionFunc {
	return func(n *Node) error {
		w, err := a.Writer(n.done, &n.wg)
		n.writer = w
		return err
	}
}
559158
func WriteWithFS(options Options, fs afero.Fs) error {
	serviceFile := optionsToServiceFile(options)

	data, err := json.MarshalIndent(serviceFile, "", "  ")
	if err != nil {
		return err
	}

	serviceConfigPath := filepath.Join(options.Dir, "service.json")
	err = afero.WriteFile(fs, serviceConfigPath, data, 0644)

	if err != nil {
		return err
	}

	return nil
}
339760
func (lr *LinearSVC) Save(filePath string) error {
	writer, err := base.CreateSerializedClassifierStub(filePath, lr.GetMetadata())
	if err != nil {
		return err
	}
	defer func() {
		writer.Close()
	}()
	fmt.Printf("writer: %v", writer)
	return lr.SaveWithPrefix(writer, "")
}
1281633
func (rt *RandomTree) SaveWithPrefix(writer *base.ClassifierSerializer, prefix string) error {
	return rt.Root.SaveWithPrefix(writer, prefix)
}
1315557
func (client *Client) Save() error {
    _, err := client.sendCommand("SAVE")
    if err != nil {
        return err
    }
    return nil
}
123155
func InterpolateWith(resolver interpolate.VariableResolver) mapdecode.Option {
	return mapdecode.FieldHook(func(dest reflect.StructField, srcData reflect.Value) (reflect.Value, error) {
		shouldInterpolate := false

		options := strings.Split(dest.Tag.Get(_tagName), ",")[1:]
		for _, option := range options {
			if option == _interpolateOption {
				shouldInterpolate = true
				break
			}
		}

		if !shouldInterpolate {
			return srcData, nil
		}

		// Use Interface().(string) so that we handle the case where data is an
		// interface{} holding a string.
		v, ok := srcData.Interface().(string)
		if !ok {
			// Cannot interpolate non-string type. This shouldn't be an error
			// because an integer field may be marked as interpolatable and may
			// have received an integer as expected.
			return srcData, nil
		}

		s, err := interpolate.Parse(v)
		if err != nil {
			return srcData, fmt.Errorf("failed to parse %q for interpolation: %v", v, err)
		}

		newV, err := s.Render(resolver)
		if err != nil {
			return srcData, fmt.Errorf("failed to render %q with environment variables: %v", v, err)
		}

		return reflect.ValueOf(newV), nil
	})
}
659254
func (builder *StoreBucketTypePropsCommandBuilder) WithR(r uint32) *StoreBucketTypePropsCommandBuilder {
	builder.props.R = &r
	return builder
}
877219
func (l Logger) With() Context {
	context := l.context
	l.context = make([]byte, 0, 500)
	if context != nil {
		l.context = append(l.context, context...)
	}
	return Context{l}
}
39240
func (rep *Responder) With(formats interface{}, fc func()) *Responder {
	if f, ok := formats.(string); ok {
		rep.responds[f] = fc
	} else if fs, ok := formats.([]string); ok {
		for _, f := range fs {
			rep.responds[f] = fc
		}
	}

	if rep.DefaultResponder == nil {
		rep.DefaultResponder = fc
	}
	return rep
}
569280
func (i *InstallReceipt) Save(w io.Writer) error {
	data, err := json.MarshalIndent(i, "", "  ")
	if err != nil {
		return err
	}
	_, err = w.Write(data)
	w.Write([]byte("\n"))
	return err
}
221531
func (c *causeT) With(keyvals ...interface{}) Error {
	return &causeT{
		errorT: c.errorT.withKeyvals(keyvals),
		cause:  c.cause,
	}
}
267237
func (_m *Client) WithOptions(opts pebbleclient.Options) pebbleclient.Client {
	ret := _m.Called(opts)

	var r0 pebbleclient.Client
	if rf, ok := ret.Get(0).(func(pebbleclient.Options) pebbleclient.Client); ok {
		r0 = rf(opts)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(pebbleclient.Client)
		}
	}

	return r0
}