Giter Site home page Giter Site logo

Comments (8)

smartwalle avatar smartwalle commented on July 18, 2024

直接 go test 即可,后面不要加文件

from alipay.

goodforever avatar goodforever commented on July 18, 2024

对,直接 go test 后面不要加文件能通过测试,这是什么原因?我在我的程序里用 var p = AliPayTradePagePay{}的时候也是undefined: AliPayTradePagePay

from alipay.

smartwalle avatar smartwalle commented on July 18, 2024

我觉得应该是�和 go path 有关系,建议你多尝试一下

from alipay.

goodforever avatar goodforever commented on July 18, 2024

你go test trade_test.go 正常吗?为何go test 正常,而go test trade_test.go报undefined: AliPayTradePagePay?

from alipay.

smartwalle avatar smartwalle commented on July 18, 2024

在某一个包下面执行 go test,默认对象是这个包下的所有源代码文件;如果 go test file.go ,那在 test 的时候就只是针对这一个文件,因为这个项目的test文件和源代码是放在一个包下,所以在 test 文件中并不需要单独的导入相关的包,所以你go test trade_test.go 会报各种undefined, 去好好检查一下你的代码,要么是包引入错误,要么就是go path 设置有问题

from alipay.

goodforever avatar goodforever commented on July 18, 2024

我是:
go get github.com/smartwalle/alipay
cd github.com/smartwalle/alipay
go test OK
go test trade_test.go

command-line-arguments

./trade_test.go:22: undefined: AliPayTradeQuery
./trade_test.go:25: undefined: client in client.TradeQuery
./trade_test.go:36: undefined: AliPayTradeAppPay
./trade_test.go:43: undefined: client in client.TradeAppPay
./trade_test.go:49: undefined: AliPayTradePagePay
./trade_test.go:56: undefined: client in client.TradePagePay
也就是在你的源码目录下,无任何我的代码,我别的github.com/xxx/xxx及自己的项目都正常,go path应没问题。请问在你的系统中 go test trade_test.go 没问题吗?

from alipay.

smartwalle avatar smartwalle commented on July 18, 2024

请仔细看我的上一条回复

from alipay.

smartwalle avatar smartwalle commented on July 18, 2024

或者加我qq 917996695

from alipay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.