test.go 462 B

1234567891011121314151617181920212223242526
  1. package cmd
  2. import (
  3. "fmt"
  4. "git.wanbits.cc/sin/flytalk/config"
  5. "git.wanbits.cc/sin/flytalk/models"
  6. "github.com/spf13/cobra"
  7. )
  8. var testCmd = &cobra.Command{
  9. Use: "test",
  10. Short: "test config file",
  11. Run: func(cmd *cobra.Command, args []string) {
  12. test()
  13. },
  14. }
  15. func test() {
  16. _, err := config.LoadConf(Confile)
  17. if err != nil {
  18. panic(err)
  19. }
  20. models.InitDb()
  21. fmt.Printf("config file <%v> tested successful. and connect database well.\n", Confile)
  22. }