1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 09:00:55 +00:00

test the env use GOPATH not GOROOT

This commit is contained in:
ysqi 2016-03-14 19:22:00 +08:00
parent 9c7d95b071
commit 1b04571c0b
5 changed files with 29 additions and 29 deletions

View File

@ -132,7 +132,7 @@ func ChooseRealValueForMap(m map[string]interface{}) map[string]interface{} {
// //
// It accept value formats "$$env" , "$$env||" , "$$env||defaultValue" , "defaultvalue". // It accept value formats "$$env" , "$$env||" , "$$env||defaultValue" , "defaultvalue".
// Examples: // 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/". // v2 := config.ChooseRealValue("$$GOAsta||/usr/local/go/") // return the default value "/usr/local/go/".
// v3 := config.ChooseRealValue("Astaxie") // return the value "Astaxie". // v3 := config.ChooseRealValue("Astaxie") // return the value "Astaxie".
func ChooseRealValue(value string) (realValue string) { func ChooseRealValue(value string) (realValue string) {

View File

@ -42,9 +42,9 @@ needlogin = ON
enableSession = Y enableSession = Y
enableCookie = N enableCookie = N
flag = 1 flag = 1
path1 = $$GOROOT path1 = $$GOPATH
path2 = $$GOROOT||/home/go path2 = $$GOPATH||/home/go
path3 = $$GOROOT$$GOPATH2||/home/go path3 = $$GOPATH$$GOPATH2||/home/go
token1 = $$TOKEN token1 = $$TOKEN
token2 = $$TOKEN|| token2 = $$TOKEN||
token3 = $$TOKEN||astaxie token3 = $$TOKEN||astaxie
@ -55,7 +55,7 @@ key1="asta"
key2 = "xie" key2 = "xie"
CaseInsensitive = true CaseInsensitive = true
peers = one;two;three peers = one;two;three
password = $$GOROOT password = $$GOPATH
` `
keyValue = map[string]interface{}{ keyValue = map[string]interface{}{
@ -73,8 +73,8 @@ password = $$GOROOT
"enableSession": true, "enableSession": true,
"enableCookie": false, "enableCookie": false,
"flag": true, "flag": true,
"path1": os.Getenv("GOROOT"), "path1": os.Getenv("GOPATH"),
"path2": os.Getenv("GOROOT"), "path2": os.Getenv("GOPATH"),
"path3": "/home/go", "path3": "/home/go",
"token1": "", "token1": "",
"token2": "", "token2": "",
@ -85,7 +85,7 @@ password = $$GOROOT
"demo::key2": "xie", "demo::key2": "xie",
"demo::CaseInsensitive": true, "demo::CaseInsensitive": true,
"demo::peers": []string{"one", "two", "three"}, "demo::peers": []string{"one", "two", "three"},
"demo::password": os.Getenv("GOROOT"), "demo::password": os.Getenv("GOPATH"),
"null": "", "null": "",
"demo2::key1": "", "demo2::key1": "",
"error": "", "error": "",

View File

@ -86,9 +86,9 @@ func TestJson(t *testing.T) {
"enableSession": "Y", "enableSession": "Y",
"enableCookie": "N", "enableCookie": "N",
"flag": 1, "flag": 1,
"path1": "$$GOROOT", "path1": "$$GOPATH",
"path2": "$$GOROOT||/home/go", "path2": "$$GOPATH||/home/go",
"path3": "$$GOROOT$$GOPATH2||/home/go", "path3": "$$GOPATH$$GOPATH2||/home/go",
"token1": "$$TOKEN", "token1": "$$TOKEN",
"token2": "$$TOKEN||", "token2": "$$TOKEN||",
"token3": "$$TOKEN||astaxie", "token3": "$$TOKEN||astaxie",
@ -99,12 +99,12 @@ func TestJson(t *testing.T) {
"port": "port", "port": "port",
"database": "database", "database": "database",
"username": "username", "username": "username",
"password": "$$GOROOT", "password": "$$GOPATH",
"conns":{ "conns":{
"maxconnection":12, "maxconnection":12,
"autoconnect":true, "autoconnect":true,
"connectioninfo":"info", "connectioninfo":"info",
"root": "$$GOROOT" "root": "$$GOPATH"
} }
} }
}` }`
@ -124,8 +124,8 @@ func TestJson(t *testing.T) {
"enableSession": true, "enableSession": true,
"enableCookie": false, "enableCookie": false,
"flag": true, "flag": true,
"path1": os.Getenv("GOROOT"), "path1": os.Getenv("GOPATH"),
"path2": os.Getenv("GOROOT"), "path2": os.Getenv("GOPATH"),
"path3": "/home/go", "path3": "/home/go",
"token1": "", "token1": "",
"token2": "", "token2": "",
@ -135,11 +135,11 @@ func TestJson(t *testing.T) {
"database::host": "host", "database::host": "host",
"database::port": "port", "database::port": "port",
"database::database": "database", "database::database": "database",
"database::password": os.Getenv("GOROOT"), "database::password": os.Getenv("GOPATH"),
"database::conns::maxconnection": 12, "database::conns::maxconnection": 12,
"database::conns::autoconnect": true, "database::conns::autoconnect": true,
"database::conns::connectioninfo": "info", "database::conns::connectioninfo": "info",
"database::conns::root": os.Getenv("GOROOT"), "database::conns::root": os.Getenv("GOPATH"),
"unknown": "", "unknown": "",
} }
) )

View File

@ -35,9 +35,9 @@ func TestXML(t *testing.T) {
<runmode>dev</runmode> <runmode>dev</runmode>
<autorender>false</autorender> <autorender>false</autorender>
<copyrequestbody>true</copyrequestbody> <copyrequestbody>true</copyrequestbody>
<path1>$$GOROOT</path1> <path1>$$GOPATH</path1>
<path2>$$GOROOT||/home/go</path2> <path2>$$GOPATH||/home/go</path2>
<path3>$$GOROOT$$GOPATH2||/home/go</path3> <path3>$$GOPATH$$GOPATH2||/home/go</path3>
<token1>$$TOKEN</token1> <token1>$$TOKEN</token1>
<token2>$$TOKEN||</token2> <token2>$$TOKEN||</token2>
<token3>$$TOKEN||astaxie</token3> <token3>$$TOKEN||astaxie</token3>
@ -53,8 +53,8 @@ func TestXML(t *testing.T) {
"runmode": "dev", "runmode": "dev",
"autorender": false, "autorender": false,
"copyrequestbody": true, "copyrequestbody": true,
"path1": os.Getenv("GOROOT"), "path1": os.Getenv("GOPATH"),
"path2": os.Getenv("GOROOT"), "path2": os.Getenv("GOPATH"),
"path3": "/home/go", "path3": "/home/go",
"token1": "", "token1": "",
"token2": "", "token2": "",

View File

@ -33,10 +33,10 @@ func TestYaml(t *testing.T) {
"runmode": dev "runmode": dev
"autorender": false "autorender": false
"copyrequestbody": true "copyrequestbody": true
"PATH": GOROOT "PATH": GOPATH
"path1": $$GOROOT "path1": $$GOPATH
"path2": $$GOROOT||/home/go "path2": $$GOPATH||/home/go
"path3": $$GOROOT$$GOPATH2||/home/go "path3": $$GOPATH$$GOPATH2||/home/go
"token1": $$TOKEN "token1": $$TOKEN
"token2": $$TOKEN|| "token2": $$TOKEN||
"token3": $$TOKEN||astaxie "token3": $$TOKEN||astaxie
@ -53,9 +53,9 @@ func TestYaml(t *testing.T) {
"runmode": "dev", "runmode": "dev",
"autorender": false, "autorender": false,
"copyrequestbody": true, "copyrequestbody": true,
"PATH": "GOROOT", "PATH": "GOPATH",
"path1": os.Getenv("GOROOT"), "path1": os.Getenv("GOPATH"),
"path2": os.Getenv("GOROOT"), "path2": os.Getenv("GOPATH"),
"path3": "/home/go", "path3": "/home/go",
"token1": "", "token1": "",
"token2": "", "token2": "",