gitea

Зеркало из https://github.com/go-gitea/gitea
Форк
0
/
main.go 
60 строк · 1.5 Кб
1
// Copyright 2014 The Gogs Authors. All rights reserved.
2
// Copyright 2016 The Gitea Authors. All rights reserved.
3
// SPDX-License-Identifier: MIT
4

5
package main
6

7
import (
8
	"os"
9
	"runtime"
10
	"strings"
11
	"time"
12

13
	"code.gitea.io/gitea/cmd"
14
	"code.gitea.io/gitea/modules/log"
15
	"code.gitea.io/gitea/modules/setting"
16

17
	// register supported doc types
18
	_ "code.gitea.io/gitea/modules/markup/asciicast"
19
	_ "code.gitea.io/gitea/modules/markup/console"
20
	_ "code.gitea.io/gitea/modules/markup/csv"
21
	_ "code.gitea.io/gitea/modules/markup/markdown"
22
	_ "code.gitea.io/gitea/modules/markup/orgmode"
23

24
	"github.com/urfave/cli/v2"
25
)
26

27
// these flags will be set by the build flags
28
var (
29
	Version     = "development" // program version for this build
30
	Tags        = ""            // the Golang build tags
31
	MakeVersion = ""            // "make" program version if built with make
32
)
33

34
func init() {
35
	setting.AppVer = Version
36
	setting.AppBuiltWith = formatBuiltWith()
37
	setting.AppStartTime = time.Now().UTC()
38
}
39

40
func main() {
41
	cli.OsExiter = func(code int) {
42
		log.GetManager().Close()
43
		os.Exit(code)
44
	}
45
	app := cmd.NewMainApp(cmd.AppVersion{Version: Version, Extra: formatBuiltWith()})
46
	_ = cmd.RunMainApp(app, os.Args...) // all errors should have been handled by the RunMainApp
47
	log.GetManager().Close()
48
}
49

50
func formatBuiltWith() string {
51
	version := runtime.Version()
52
	if len(MakeVersion) > 0 {
53
		version = MakeVersion + ", " + runtime.Version()
54
	}
55
	if len(Tags) == 0 {
56
		return " built with " + version
57
	}
58

59
	return " built with " + version + " : " + strings.ReplaceAll(Tags, " ", ", ")
60
}
61

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.