Browse Source

fix lint ci

pull/288/head
yedf2 4 years ago
parent
commit
4e7e255997
  1. 1
      dtmsvr/api.go
  2. 5
      dtmsvr/config/config.go
  3. 2
      dtmsvr/config/config_utils.go
  4. 2
      dtmsvr/entry/main.go
  5. 4
      main.go

1
dtmsvr/api.go

@ -15,6 +15,7 @@ import (
"github.com/dtm-labs/dtm/dtmsvr/storage"
)
// Version store the passin version for dtm server
var Version = ""
func svcSubmit(t *TransGlobal) interface{} {

5
dtmsvr/config/config.go

@ -79,7 +79,8 @@ func (s *Store) GetDBConf() dtmcli.DBConf {
}
}
type ConfigType struct {
// Type is the type for the config of dtm server
type Type struct {
Store Store `yaml:"Store"`
TransCronInterval int64 `yaml:"TransCronInterval" default:"3"`
TimeoutToFail int64 `yaml:"TimeoutToFail" default:"35"`
@ -97,7 +98,7 @@ type ConfigType struct {
}
// Config config
var Config = ConfigType{}
var Config = Type{}
// MustLoadConfig load config from env and file
func MustLoadConfig(confFile string) {

2
dtmsvr/config/config_utils.go

@ -58,7 +58,7 @@ func toUnderscoreUpper(key string) string {
return strings.ToUpper(s2)
}
func checkConfig(conf *ConfigType) error {
func checkConfig(conf *Type) error {
if conf.RetryInterval < 10 {
return errors.New("RetryInterval should not be less than 10")
}

2
dtmsvr/entry/main.go

@ -28,7 +28,7 @@ var isReset = flag.Bool("r", false, "Reset dtm server data.")
var confFile = flag.String("c", "", "Path to the server configuration file.")
// Main is the entry point of dtm server.
func Main(version *string) (*gin.Engine, *config.ConfigType) {
func Main(version *string) (*gin.Engine, *config.Type) {
flag.Parse()
if *version == "" {
*version = "v0.0.0-dev"

4
main.go

@ -43,15 +43,15 @@ func getSub(f1 fs.FS, sub string) fs.FS {
logger.FatalIfError(err)
return f2
}
func addAdmin(app *gin.Engine, conf *config.ConfigType) {
func addAdmin(app *gin.Engine, conf *config.Type) {
// for released dtm, serve admin from local files because the build output has been embed
// for testing users, proxy admin to target because the build output has not been embed
dist := getSub(admin, "admin/dist")
index, err := dist.Open("index.html")
if err == nil {
defer index.Close()
cont, err := ioutil.ReadAll(index)
logger.FatalIfError(err)
_ = index.Close()
sfile := string(cont)
renderIndex := func(c *gin.Context) {
c.Header("content-type", "text/html;charset=utf-8")

Loading…
Cancel
Save