97 }
98
99 if minDBVersion > current.Version {
100 log.Fatal(`101Hi there, thank you for using Gogs for so long!
102However, Gogs has stopped supporting auto-migration from your previously installed version.
103But the good news is, it's very easy to fix this problem!
184
185 keys, err := setupHostKeys(appDataPath, opts.ServerAlgorithms)
186 if err != nil {
187 log.Fatal("SSH: Failed to setup host keys: %v", err)188 }
189 for _, key := range keys {
190 config.AddHostKey(key)
131func listen(config *ssh.ServerConfig, host string, port int) {
132 listener, err := net.Listen("tcp", host+":"+com.ToStr(port))
133 if err != nil {
134 log.Fatal("Failed to start SSH server: %v", err)135 }
136 for {
137 // Once a ServerConfig has been configured, connections can be accepted.
58 if conf.Cron.RepoArchiveCleanup.Enabled {
59 entry, err = c.AddFunc("Repository archive cleanup", conf.Cron.RepoArchiveCleanup.Schedule, database.DeleteOldRepositoryArchives)
60 if err != nil {
61 log.Fatal("Cron.(repository archive cleanup): %v", err)62 }
63 if conf.Cron.RepoArchiveCleanup.RunAtStart {
64 entry.Prev = time.Now()
47 if conf.Cron.CheckRepoStats.Enabled {
48 entry, err = c.AddFunc("Check repository statistics", conf.Cron.CheckRepoStats.Schedule, database.CheckRepoStats)
49 if err != nil {
50 log.Fatal("Cron.(check repository statistics): %v", err)51 }
52 if conf.Cron.CheckRepoStats.RunAtStart {
53 entry.Prev = time.Now()
Packages exposing functions that can stop program execution by exiting are hard to reuse. Program exits in functions other than main() or init() are not encouraged.
func nonMainFunc() {
safelyExit := true // somehow arrive at this value
if safelyExit {
os.Exit(0)
}
}
func main() {
nonMainFunc()
}
func nonMainFunc() bool {
safelyExit := true // somehow arrive at this value
}
func main() {
safelyExit := nonMainFunc()
if safelyExit {
os.Exit(0)
}
}