From 920b15f69cd7749ab5f45b121132e92de2ef6e15 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 11 Feb 2016 18:29:11 +0100 Subject: Reduce code complexity --- main.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 586a81a4..3a6cdd9c 100644 --- a/main.go +++ b/main.go @@ -102,6 +102,14 @@ func (a *theApp) UpdateDomains(domains domains) { a.lock.Unlock() } +func resolve() { + fullPath, err := filepath.EvalSymlinks(*pagesRoot) + if err != nil { + log.Fatalln(err) + } + *pagesRoot = fullPath +} + func main() { var wg sync.WaitGroup var app theApp @@ -109,12 +117,7 @@ func main() { fmt.Printf("GitLab Pages Daemon %s (%s)", VERSION, REVISION) fmt.Printf("URL: https://gitlab.com/gitlab-org/gitlab-pages") flag.Parse() - - fullPath, err := filepath.EvalSymlinks(*pagesRoot) - if err != nil { - log.Fatalln(err) - } - *pagesRoot = fullPath + resolve() // Listen for HTTP if *listenHTTP != "" { -- cgit v1.2.3