main.go 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "xgAutoTest/internal/auto"
  6. "xgAutoTest/internal/config"
  7. "xgAutoTest/internal/dbBase"
  8. "xgAutoTest/internal/global"
  9. "xgAutoTest/internal/utils"
  10. )
  11. func main() {
  12. os.Setenv("GODEBUG", "cgocheck=0")
  13. if len(os.Args) < 2 {
  14. fmt.Println("请输入配置文件路径")
  15. return
  16. }
  17. path := os.Args[1]
  18. if path == "version" {
  19. fmt.Println("当前版本:demo")
  20. return
  21. }
  22. fmt.Println("配置文件路径:", path)
  23. checkAll()
  24. global.Init()
  25. config := config.ConfigInfo{}
  26. config.GetConfigInfo(path)
  27. //dbBase.InitDb("10.28.20.101", "5190", "TESTDB", "SYSDBA", "SYSDBA")
  28. fmt.Println(config.DbInfo)
  29. dbBase.InitDb(config.DbInfo.Ip, config.DbInfo.Prot, config.DbInfo.Database, config.DbInfo.User, config.DbInfo.PassWord)
  30. auto.AutoRun(config)
  31. db := dbBase.GetDb()
  32. defer db.Close()
  33. }
  34. func checkAll() {
  35. //检查文件夹
  36. ret := utils.CheckFolder("./file")
  37. if !ret {
  38. utils.CreateFolder("./file")
  39. }
  40. }