Reputation: 1270
I have a strange behaviour on Travis CI on a GO project.
It fails [here], complaining about a function taking just 1 parameter and being called with 2.
src/finances-service/main.go:45:19: too many arguments in call to route.Register
have (*gin.Engine, *controller.TokensController)
want (*controller.TokensController)
It used to accept only the TokensController
, but now, in this pull request, it accepts also a gin.Engine
.
If we look at the source code for this file in this branch, we can see the function signature accepting the 2 parameters.
func Register(
engine *gin.Engine,
tokensController *controller.TokensController,
) {
It is then being called once in production code.
route.Register(engine, tokensController)
and once in test code.
route.Register(testRoute, tokensController)
I do not understand this behaviour. I am sure there is something obvious about it, I just do not see it. I humbly ask for your help. I have sent an email to Travis CI, but am still waiting for the answer. Looking on all fronts for help on this. Thanks in advance.
Upvotes: 0
Views: 60
Reputation: 1124
I have just cloned the repo in my local environment and make build
passed for master
and 22-banner
branches.
I messed out a little and realized that you have vendored your own src dir. It's absolutely not a good idea.
If you track down to the route package, it will end up somewhere in vendor folder, not somewhere it should be.
So what's the resolution?
First of all, if you really want to use Dep, then you have to put that vendor
directory in root. Gopkg.*
files are nothing without it.
I see that you have three branches and you're using the same dependencies even though you're trying to use a different (or wrong) signature in master
. As I stated above, you also have had your own package vendored. You should not do this for local packages inside your working directory. If you really want, you can create another repo with version tags.
Then, you have to make sure that you're on the $GOPATH/src/github.com/<xxx>/<yyy>
on Travis build, your repo must live there.
After that, since your local package isn't cached in vendor folder, it will successfully build on Travis.
P.S.: For testing purposes, just purge everything created by Dep and use only go get
. The problem arised here is only about vendoring.
Upvotes: 1