|
|
@ -10,7 +10,7 @@ import ( |
|
|
|
|
|
|
|
func main() { |
|
|
|
glog.Info("开始-读取配置文件...") |
|
|
|
config := initFunc() |
|
|
|
config := initFunc2() |
|
|
|
if config == nil { |
|
|
|
return |
|
|
|
} |
|
|
@ -25,7 +25,7 @@ func main() { |
|
|
|
} |
|
|
|
|
|
|
|
glog.Info("开始-读取文件内容获取异常单元格列表...") |
|
|
|
cells, err := readExcel(xlsx, sheetName) |
|
|
|
cells, err := readExcel2(xlsx, sheetName) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
@ -80,12 +80,12 @@ func makeExcelStyle2(xlsx *excelize.File, sheetName string, cells map[int]string |
|
|
|
/** |
|
|
|
initFunc 执行读取 yaml 配置文件 |
|
|
|
*/ |
|
|
|
func initFunc2() *Config { |
|
|
|
func initFunc2() *Config2 { |
|
|
|
path, _ := filepath.Abs("./") |
|
|
|
path += "\\config.yaml" |
|
|
|
glog.Info("读取配置文件:", path) |
|
|
|
path = "D:\\ViviCode\\golangs_learn\\golang_learn\\data_office\\get_excel_velidation\\config.yaml" |
|
|
|
load, err := load(path) |
|
|
|
load, err := load2(path) |
|
|
|
if err != nil { |
|
|
|
glog.Error("读取文件发生异常...") |
|
|
|
return nil |
|
|
@ -104,8 +104,8 @@ type Config2 struct { |
|
|
|
/** |
|
|
|
load 解析 Yaml 文件 |
|
|
|
*/ |
|
|
|
func load2(path string) (*Config, error) { |
|
|
|
conf := new(Config) |
|
|
|
func load2(path string) (*Config2, error) { |
|
|
|
conf := new(Config2) |
|
|
|
yamlFile, err := ioutil.ReadFile(path) |
|
|
|
if err != nil { |
|
|
|
glog.Info("发生异常:", err) |
|
|
|