feat:完善项目信息

This commit is contained in:
henry
2021-12-28 10:38:02 +08:00
parent 76ca837fd6
commit 7eb8e5c48b
13 changed files with 161 additions and 137 deletions

35
utils/file_test.go Normal file
View File

@ -0,0 +1,35 @@
package utils
import (
"gopkg.in/yaml.v2"
"os"
"testing"
)
type config struct {
Version int
Mapping map[string]string
}
func TestNewFile(t *testing.T) {
file, err := os.OpenFile("test.yml", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
t.Log(err)
return
}
defer file.Close()
enc := yaml.NewEncoder(file)
err = enc.Encode(config{
Version: 7,
Mapping: map[string]string{
"key": "value1",
"key2": "value2",
},
})
if err != nil {
t.Log(err)
return
}
}

View File

@ -1,8 +1,6 @@
package utils
import (
"SciencesServer/app/basic/config"
"fmt"
"testing"
)
@ -27,11 +25,4 @@ func TestLoadConfig(t *testing.T) {
//out := make([]*ManagePatent, 0)
//LoadConfig(file, &out)
//fmt.Println(AnyToJSON(out))
file := "../file/sys_industry.json"
out := make([]*config.MemoryForIndustry, 0)
LoadConfig(file, &out)
fmt.Println(AnyToJSON(out))
}