Let's zone in on the problem.
This commit is contained in:
parent
7114cc1652
commit
1923ad6acb
|
@ -3,16 +3,16 @@ package main
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"runtime/debug"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"./common"
|
"./common"
|
||||||
"./install/install"
|
"./install/install"
|
||||||
"./query_gen/lib"
|
"./query_gen/lib"
|
||||||
|
@ -28,17 +28,17 @@ var installAdapter install.InstallAdapter
|
||||||
func ResetTables() (err error) {
|
func ResetTables() (err error) {
|
||||||
err = installAdapter.InitDatabase()
|
err = installAdapter.InitDatabase()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = installAdapter.TableDefs()
|
err = installAdapter.TableDefs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = installAdapter.CreateAdmin()
|
err = installAdapter.CreateAdmin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return installAdapter.InitialData()
|
return installAdapter.InitialData()
|
||||||
|
@ -59,23 +59,23 @@ func gloinit() (err error) {
|
||||||
|
|
||||||
err = common.LoadConfig()
|
err = common.LoadConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
err = common.ProcessConfig()
|
err = common.ProcessConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
common.Themes, err = common.NewThemeList()
|
common.Themes, err = common.NewThemeList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
common.SwitchToTestDB()
|
common.SwitchToTestDB()
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
installAdapter, ok = install.Lookup(dbAdapter)
|
installAdapter, ok = install.Lookup(dbAdapter)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("We couldn't find the adapter '" + dbAdapter + "'")
|
return errors.WithStack(errors.New("We couldn't find the adapter '" + dbAdapter + "'"))
|
||||||
}
|
}
|
||||||
installAdapter.SetConfig(common.DbConfig.Host, common.DbConfig.Username, common.DbConfig.Password, common.DbConfig.Dbname, common.DbConfig.Port)
|
installAdapter.SetConfig(common.DbConfig.Host, common.DbConfig.Username, common.DbConfig.Password, common.DbConfig.Dbname, common.DbConfig.Port)
|
||||||
|
|
||||||
|
@ -85,16 +85,16 @@ func gloinit() (err error) {
|
||||||
}
|
}
|
||||||
err = InitDatabase()
|
err = InitDatabase()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
err = afterDBInit()
|
err = afterDBInit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
router, err = NewGenRouter(http.FileServer(http.Dir("./uploads")))
|
router, err = NewGenRouter(http.FileServer(http.Dir("./uploads")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
gloinited = true
|
gloinited = true
|
||||||
return nil
|
return nil
|
||||||
|
@ -104,7 +104,7 @@ func init() {
|
||||||
err := gloinit()
|
err := gloinit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Something bad happened")
|
log.Print("Something bad happened")
|
||||||
debug.PrintStack()
|
//debug.PrintStack()
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue