Пример #1
0
// getStaticAppData returns app data available at start time.
// This should be called immediately, as it includes calculating when the app was started.
func getStaticAppData() (manager.StaticAppData, error) {
	var d manager.StaticAppData
	d.StartTime = time.Now()
	d.GitRevision = GitRevision
	d.FreeMemoryMB = math.MaxUint64 // TODO remove if/when nothing needs this
	d.Version = Version
	wd, err := os.Getwd()
	if err != nil {
		return manager.StaticAppData{}, err
	}
	d.WorkingDir = wd
	d.Name = os.Args[0]
	d.BuildTimestamp = BuildTimestamp
	return d, nil
}
// getStaticAppData returns app data available at start time.
// This should be called immediately, as it includes calculating when the app was started.
func getStaticAppData() (manager.StaticAppData, error) {
	var d manager.StaticAppData
	var err error
	d.StartTime = time.Now()
	d.GitRevision = GitRevision
	d.FreeMemoryMB = math.MaxUint64 // TODO remove if/when nothing needs this
	d.Version = Version
	if d.WorkingDir, err = os.Getwd(); err != nil {
		return manager.StaticAppData{}, err
	}
	d.Name = os.Args[0]
	d.BuildTimestamp = BuildTimestamp
	if d.Hostname, err = getHostNameWithoutDomain(); err != nil {
		return manager.StaticAppData{}, err
	}

	return d, nil
}