小编Gra*_*vis的帖子

自制安装特定版本的公式?

如何在自制软件中安装特定版本的公式?例如,postgresql-8.4.4而不是最新的9.0.

versioning installation homebrew

2072
推荐指数
26
解决办法
105万
查看次数

我如何等待docker容器启动并运行?

在容器内运行服务时,让我们说命令是mongodb

docker run -d myimage
Run Code Online (Sandbox Code Playgroud)

将立即退出,并返回容器ID.在我的CI脚本中,我在运行mongo容器后立即运行客户端来测试mongodb连接.问题是:客户端无法连接,因为服务尚未启动.除了sleep 10在我的脚本中添加一个大的,我没有看到任何等待容器启动和运行的选项.

Docker有一个wait在这种情况下不起作用的命令,因为容器不存在.这是码头工人的限制吗?谢谢

mongodb docker

74
推荐指数
8
解决办法
6万
查看次数

如果请求按值传递,http 请求值为空

有人可以解释这里发生了什么吗?

package main

import (
    "fmt"
    "net/http"
    "strings"
)

func Verify(req http.Request) string {
    return req.FormValue("g-recaptcha-response")
}

func main() {
    req, _ := http.NewRequest("POST", "http://www.google.com/search?q=foo&q=bar&both=x&prio=1&empty=not",
        strings.NewReader("z=post&both=y&prio=2&empty="))
    req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
    Verify(*req)
    fmt.Println(req.FormValue("z"))
}
Run Code Online (Sandbox Code Playgroud)

( https://play.golang.org/p/ve4Cc_JTzr )

这将产生一个空输出。现在,如果我将请求作为值传​​递之前访问值“z” ,它就起作用了!

package main

import (
    "fmt"
    "net/http"
    "strings"
)

func Verify(req http.Request) string {
    return req.FormValue("g-recaptcha-response")
}

func main() {
    req, _ := http.NewRequest("POST", "http://www.google.com/search?q=foo&q=bar&both=x&prio=1&empty=not",
        strings.NewReader("z=post&both=y&prio=2&empty="))
    req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
    Verify(*req)
    fmt.Println(req.FormValue("z"))
}
Run Code Online (Sandbox Code Playgroud)

( https://play.golang.org/p/5ALnt-pHTl )

我尝试了从 1.5 到 1.7 的多个版本,但结果都一样奇怪。如果请求是通过引用传递的,它会按预期工作。

go

1
推荐指数
1
解决办法
1089
查看次数

标签 统计

docker ×1

go ×1

homebrew ×1

installation ×1

mongodb ×1

versioning ×1