The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
skyFuture

请问 go 的单元测试怎么写

  •  
  •   skyFuture · Apr 18, 2018 · 3079 views
    This topic created in 3123 days ago, the information mentioned may be changed or developed.

    用 goLand 的 ide 编写 go 的单元测试,但是一 run 就发现 ./w_test.go:11:7: undefined: NewWeightedRR ./w_test.go:11:21: undefined: RR_NGINX ./w_test.go:60:7: undefined: NewWeightedRR ./w_test.go:60:21: undefined: RR_LVS

    说是我的引用有点问题,请问哪位 v 友遇到过吗

    4 replies  •  2018-04-18 19:34:52 +08:00
    cloudzhou
    cloudzhou
    Apr 18, 2018
    1
    go test
    LuoyeBug
    LuoyeBug
    Apr 18, 2018
    2
    上代码呀,github 有个 gotests 工具,挺省事的。
    gowk
    gowk
    Apr 18, 2018
    3
    justfortest
    justfortest
    Apr 18, 2018
    4
    你是不是没有以 package 方式执行?这样会导致一些 exported variable/method 无法被引用。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1464 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:59 · PVG 06:59 · LAX 14:59 · JFK 17:59
    ♥ Do have faith in what you're doing.