Browse Source

format the code

z4yx 5 years ago
parent
commit
1491b6c42b
1 changed files with 19 additions and 19 deletions
  1. 19 19
      worker/config.go

+ 19 - 19
worker/config.go

@@ -113,16 +113,16 @@ type includedMirrorConfig struct {
 }
 }
 
 
 type mirrorConfig struct {
 type mirrorConfig struct {
-	Name      string            `toml:"name"`
-	Provider  providerEnum      `toml:"provider"`
-	Upstream  string            `toml:"upstream"`
-	Interval  int               `toml:"interval"`
-	Retry     int               `toml:"retry"`
-	MirrorDir string            `toml:"mirror_dir"`
-	MirrorSubDir string         `toml:"mirror_subdir"`
-	LogDir    string            `toml:"log_dir"`
-	Env       map[string]string `toml:"env"`
-	Role      string            `toml:"role"`
+	Name         string            `toml:"name"`
+	Provider     providerEnum      `toml:"provider"`
+	Upstream     string            `toml:"upstream"`
+	Interval     int               `toml:"interval"`
+	Retry        int               `toml:"retry"`
+	MirrorDir    string            `toml:"mirror_dir"`
+	MirrorSubDir string            `toml:"mirror_subdir"`
+	LogDir       string            `toml:"log_dir"`
+	Env          map[string]string `toml:"env"`
+	Role         string            `toml:"role"`
 
 
 	// These two options over-write the global options
 	// These two options over-write the global options
 	ExecOnSuccess []string `toml:"exec_on_success"`
 	ExecOnSuccess []string `toml:"exec_on_success"`
@@ -152,7 +152,7 @@ type mirrorConfig struct {
 
 
 	SnapshotPath string `toml:"snapshot_path"`
 	SnapshotPath string `toml:"snapshot_path"`
 
 
-	ChildMirrors       []mirrorConfig      `toml:"mirrors"`
+	ChildMirrors []mirrorConfig `toml:"mirrors"`
 }
 }
 
 
 // LoadConfig loads configuration
 // LoadConfig loads configuration
@@ -185,7 +185,7 @@ func LoadConfig(cfgFile string) (*Config, error) {
 
 
 	for _, m := range cfg.MirrorsConf {
 	for _, m := range cfg.MirrorsConf {
 		if err := recursiveMirrors(cfg, nil, m); err != nil {
 		if err := recursiveMirrors(cfg, nil, m); err != nil {
-			return nil, err;
+			return nil, err
 		}
 		}
 	}
 	}
 
 
@@ -193,22 +193,22 @@ func LoadConfig(cfgFile string) (*Config, error) {
 }
 }
 
 
 func recursiveMirrors(cfg *Config, parent *mirrorConfig, mirror mirrorConfig) error {
 func recursiveMirrors(cfg *Config, parent *mirrorConfig, mirror mirrorConfig) error {
-	var curMir mirrorConfig;
+	var curMir mirrorConfig
 	if parent != nil {
 	if parent != nil {
-		curMir = *parent;
+		curMir = *parent
 	}
 	}
-	curMir.ChildMirrors = nil;
+	curMir.ChildMirrors = nil
 	if err := mergo.Merge(&curMir, mirror, mergo.WithOverride); err != nil {
 	if err := mergo.Merge(&curMir, mirror, mergo.WithOverride); err != nil {
-		return err;
+		return err
 	}
 	}
 	if mirror.ChildMirrors == nil {
 	if mirror.ChildMirrors == nil {
-		cfg.Mirrors = append(cfg.Mirrors, curMir);
+		cfg.Mirrors = append(cfg.Mirrors, curMir)
 	} else {
 	} else {
 		for _, m := range mirror.ChildMirrors {
 		for _, m := range mirror.ChildMirrors {
 			if err := recursiveMirrors(cfg, &curMir, m); err != nil {
 			if err := recursiveMirrors(cfg, &curMir, m); err != nil {
-				return err;
+				return err
 			}
 			}
 		}
 		}
 	}
 	}
-	return nil;
+	return nil
 }
 }