diff --git a/config/config.go b/config/config.go index 59cc356b..6a159f82 100644 --- a/config/config.go +++ b/config/config.go @@ -132,7 +132,7 @@ func ChooseRealValueForMap(m map[string]interface{}) map[string]interface{} { // // It accept value formats "$$env" , "$$env||" , "$$env||defaultValue" , "defaultvalue". // Examples: -// v1 := config.ChooseRealValue("$$GOROOT") // return the GOROOT environment variable. +// v1 := config.ChooseRealValue("$$GOPATH") // return the GOPATH environment variable. // v2 := config.ChooseRealValue("$$GOAsta||/usr/local/go/") // return the default value "/usr/local/go/". // v3 := config.ChooseRealValue("Astaxie") // return the value "Astaxie". func ChooseRealValue(value string) (realValue string) { diff --git a/config/ini_test.go b/config/ini_test.go index b3f57fbe..a6a66198 100644 --- a/config/ini_test.go +++ b/config/ini_test.go @@ -42,9 +42,9 @@ needlogin = ON enableSession = Y enableCookie = N flag = 1 -path1 = $$GOROOT -path2 = $$GOROOT||/home/go -path3 = $$GOROOT$$GOPATH2||/home/go +path1 = $$GOPATH +path2 = $$GOPATH||/home/go +path3 = $$GOPATH$$GOPATH2||/home/go token1 = $$TOKEN token2 = $$TOKEN|| token3 = $$TOKEN||astaxie @@ -55,7 +55,7 @@ key1="asta" key2 = "xie" CaseInsensitive = true peers = one;two;three -password = $$GOROOT +password = $$GOPATH ` keyValue = map[string]interface{}{ @@ -73,8 +73,8 @@ password = $$GOROOT "enableSession": true, "enableCookie": false, "flag": true, - "path1": os.Getenv("GOROOT"), - "path2": os.Getenv("GOROOT"), + "path1": os.Getenv("GOPATH"), + "path2": os.Getenv("GOPATH"), "path3": "/home/go", "token1": "", "token2": "", @@ -85,7 +85,7 @@ password = $$GOROOT "demo::key2": "xie", "demo::CaseInsensitive": true, "demo::peers": []string{"one", "two", "three"}, - "demo::password": os.Getenv("GOROOT"), + "demo::password": os.Getenv("GOPATH"), "null": "", "demo2::key1": "", "error": "", diff --git a/config/json_test.go b/config/json_test.go index 6ff26dba..940916a1 100644 --- a/config/json_test.go +++ b/config/json_test.go @@ -86,9 +86,9 @@ func TestJson(t *testing.T) { "enableSession": "Y", "enableCookie": "N", "flag": 1, -"path1": "$$GOROOT", -"path2": "$$GOROOT||/home/go", -"path3": "$$GOROOT$$GOPATH2||/home/go", +"path1": "$$GOPATH", +"path2": "$$GOPATH||/home/go", +"path3": "$$GOPATH$$GOPATH2||/home/go", "token1": "$$TOKEN", "token2": "$$TOKEN||", "token3": "$$TOKEN||astaxie", @@ -99,12 +99,12 @@ func TestJson(t *testing.T) { "port": "port", "database": "database", "username": "username", - "password": "$$GOROOT", + "password": "$$GOPATH", "conns":{ "maxconnection":12, "autoconnect":true, "connectioninfo":"info", - "root": "$$GOROOT" + "root": "$$GOPATH" } } }` @@ -124,8 +124,8 @@ func TestJson(t *testing.T) { "enableSession": true, "enableCookie": false, "flag": true, - "path1": os.Getenv("GOROOT"), - "path2": os.Getenv("GOROOT"), + "path1": os.Getenv("GOPATH"), + "path2": os.Getenv("GOPATH"), "path3": "/home/go", "token1": "", "token2": "", @@ -135,11 +135,11 @@ func TestJson(t *testing.T) { "database::host": "host", "database::port": "port", "database::database": "database", - "database::password": os.Getenv("GOROOT"), + "database::password": os.Getenv("GOPATH"), "database::conns::maxconnection": 12, "database::conns::autoconnect": true, "database::conns::connectioninfo": "info", - "database::conns::root": os.Getenv("GOROOT"), + "database::conns::root": os.Getenv("GOPATH"), "unknown": "", } ) diff --git a/config/xml/xml_test.go b/config/xml/xml_test.go index 85c92e8b..825f4d0d 100644 --- a/config/xml/xml_test.go +++ b/config/xml/xml_test.go @@ -35,9 +35,9 @@ func TestXML(t *testing.T) { dev false true -$$GOROOT -$$GOROOT||/home/go -$$GOROOT$$GOPATH2||/home/go +$$GOPATH +$$GOPATH||/home/go +$$GOPATH$$GOPATH2||/home/go $$TOKEN $$TOKEN|| $$TOKEN||astaxie @@ -53,8 +53,8 @@ func TestXML(t *testing.T) { "runmode": "dev", "autorender": false, "copyrequestbody": true, - "path1": os.Getenv("GOROOT"), - "path2": os.Getenv("GOROOT"), + "path1": os.Getenv("GOPATH"), + "path2": os.Getenv("GOPATH"), "path3": "/home/go", "token1": "", "token2": "", diff --git a/config/yaml/yaml_test.go b/config/yaml/yaml_test.go index 30c79d0b..0731778f 100644 --- a/config/yaml/yaml_test.go +++ b/config/yaml/yaml_test.go @@ -33,10 +33,10 @@ func TestYaml(t *testing.T) { "runmode": dev "autorender": false "copyrequestbody": true -"PATH": GOROOT -"path1": $$GOROOT -"path2": $$GOROOT||/home/go -"path3": $$GOROOT$$GOPATH2||/home/go +"PATH": GOPATH +"path1": $$GOPATH +"path2": $$GOPATH||/home/go +"path3": $$GOPATH$$GOPATH2||/home/go "token1": $$TOKEN "token2": $$TOKEN|| "token3": $$TOKEN||astaxie @@ -53,9 +53,9 @@ func TestYaml(t *testing.T) { "runmode": "dev", "autorender": false, "copyrequestbody": true, - "PATH": "GOROOT", - "path1": os.Getenv("GOROOT"), - "path2": os.Getenv("GOROOT"), + "PATH": "GOPATH", + "path1": os.Getenv("GOPATH"), + "path2": os.Getenv("GOPATH"), "path3": "/home/go", "token1": "", "token2": "",