// MustNewFrom creates a new config object normalizing and copying from into the new
// Config object. MustNewFrom uses Merge to copy from.
//
// MustNewFrom supports the options: PathSep, MetaData, StructTag, VarExp
162997
func MustNewFrom(from interface{}, opts ...Option) *Config {
	c := New()
	if err := c.Merge(from, opts...); err != nil {
		panic(err)
	}
	return c
}
815398
func MustNewUnit(m map[string]int64) *Unit {
	u, err := NewUnit(m)
	if err != nil {
		panic(fmt.Sprintf("MustNewUnit error: %v", err))
	}
	return u
}
216521
func NewEmptyConfig() *Config {
	ret := &Config{}
	ret.Root = ret
	ret.Children = make(map[string]*Config)
	ret.Module = &Module{}
	return ret
}
159716
func NewErrorFrom(kind ErrorKind, inner error) *Error {
	return &Error{
		kind:  kind,
		inner: inner,
	}
}
79529
func NewRawConfig(raw map[string]interface{}) (*RawConfig, error) {
	result := &RawConfig{Raw: raw}
	if err := result.init(); err != nil {
		return nil, err
	}

	return result, nil
}
708820
func (n *Graph) AddNew(processName string, componentName string, f *Factory) error {
	proc, err := f.Create(componentName)
	if err != nil {
		return err
	}
	return n.Add(processName, proc)
}
871460
func Must(v interface{}, err error) interface{} {
	if err != nil {
		panic("copy error: " + err.Error())
	}

	return v
}
1142919
func NewNonInteractiveDeferredLoadingClientConfig(loader ClientConfigLoader, overrides *ConfigOverrides) ClientConfig {
	return &DeferredLoadingClientConfig{loader: loader, overrides: overrides, icc: &inClusterClientConfig{overrides: overrides}}
}
1157809
func NewFrom(v Values) *Configuration {
	c := &Configuration{
		Os:        EnvironmentOf(mapFetcher(v.Os)),
		gitConfig: git.NewConfig("", ""),
		timestamp: time.Now(),
	}
	c.Git = &delayedEnvironment{
		callback: func() Environment {
			source := &git.ConfigurationSource{
				Lines: make([]string, 0, len(v.Git)),
			}

			for key, values := range v.Git {
				parts := strings.Split(key, ".")
				isCaseSensitive := len(parts) >= 3
				hasUpper := strings.IndexFunc(key, unicode.IsUpper) > -1

				// This branch should only ever trigger in
				// tests, and only if they'd be broken.
				if !isCaseSensitive && hasUpper {
					panic(fmt.Sprintf("key %q has uppercase, shouldn't", key))
				}
				for _, value := range values {
					fmt.Printf("Config: %s=%s\n", key, value)
					source.Lines = append(source.Lines, fmt.Sprintf("%s=%s", key, value))
				}
			}

			return c.readGitConfig(source)
		},
	}
	return c
}
154775
func NewConf() *Config {
	return &Config{
		DefaultLevel: "",
		Loggers:      []LoggerConfig{},
		Hooks:        make(map[string]HookConfig),
	}
}
1235818
func NewFromEnvironment(keepReloading bool) (*Config, error) {
	cnf, err := fromEnvironment()
	if err != nil {
		return nil, err
	}

	log.INFO.Print("Successfully loaded config from the environment")

	if keepReloading {
		// Open a goroutine to watch remote changes forever
		go func() {
			for {
				// Delay after each request
				time.Sleep(reloadDelay)

				// Attempt to reload the config
				newCnf, newErr := fromEnvironment()
				if newErr != nil {
					log.WARNING.Printf("Failed to reload config from the environment: %v", newErr)
					continue
				}

				*cnf = *newCnf
				// log.INFO.Printf("Successfully reloaded config from the environment")
			}
		}()
	}

	return cnf, nil
}
1156194
func MustNewUUID() *UUID {
	uuid, err := NewUUID()
	if err != nil {
		panic(err)
	}
	return uuid
}
1013953
func (w *bufferedWriter) createNewWriter(file *os.File) io.Writer {
	w.buf = bufio.NewWriterSize(file, w.bufSize)
	return w.buf
}
924378
func NewClientFromConfig(cfg HTTPClientConfig, name string) (*http.Client, error) {
	rt, err := NewRoundTripperFromConfig(cfg, name)
	if err != nil {
		return nil, err
	}
	return newClient(rt), nil
}
1227808
func NewConfig(adapterName, filename string) (Configer, error) {
	adapter, ok := adapters[adapterName]
	if !ok {
		return nil, fmt.Errorf("config: unknown adaptername %q (forgotten import?)", adapterName)
	}
	return adapter.Parse(filename)
}
28847
func (c *Context) MustBindWith(obj interface{}, b binding.Binding) error {
	if err := c.ShouldBindWith(obj, b); err != nil {
		c.AbortWithError(http.StatusBadRequest, err).SetType(ErrorTypeBind) // nolint: errcheck
		return err
	}
	return nil
}
1179945
func (d *InstanceDiff) RequiresNew() bool {
	if d == nil {
		return false
	}

	d.mu.Lock()
	defer d.mu.Unlock()

	return d.requiresNew()
}