Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-error occur when build generated code #216

Closed
KerwinKoo opened this issue Jan 24, 2016 · 4 comments
Closed

build-error occur when build generated code #216

KerwinKoo opened this issue Jan 24, 2016 · 4 comments

Comments

@KerwinKoo
Copy link

I just run the test code in READEM.md.

After running $ goagen bootstrap -d goa-adder/design, when I go build the generated code, some error showed in the terminal:

# goa-adder
./main.go:21: cannot use service (type "github.com/goadesign/goa".Service) as type "github.com/raphael/goa".Service in argument to NewOperandsController:
    "github.com/goadesign/goa".Service does not implement "github.com/raphael/goa".Service (wrong type for DecodeRequest method)
        have DecodeRequest(*"github.com/goadesign/goa".Context, interface {}) error
        want DecodeRequest(*"github.com/raphael/goa".Context, interface {}) error
./operands.go:16: cannot use OperandsController literal (type *OperandsController) as type app.OperandsController in return argument:
    *OperandsController does not implement app.OperandsController (wrong type for ErrorHandler method)
        have ErrorHandler() "github.com/raphael/goa".ErrorHandler
        want ErrorHandler() "github.com/goadesign/goa".ErrorHandler

I don't know what causes that, but It's fun befor I running go get -v -u https://github.com/goadesign/goa to update Goa package. Can it be possible that the error caused by the new version?

@KerwinKoo KerwinKoo reopened this Jan 24, 2016
@raphael
Copy link
Member

raphael commented Jan 24, 2016

Is it possible that you have an old goagen laying around? I see that the code is using raphael/goa instead of the new location goadesign/goa. Maybe try doing a go get -u github.com/goadesign/goa/goagen.

@KerwinKoo
Copy link
Author

I knew what happend. It created a new directory named github.com/raphael/ when I update Goa by running "go get -u", goimport can thus import this raphael package.

Now I deleted this wrong package path. But I also don't know why the raphael can be created after updating?

@raphael
Copy link
Member

raphael commented Jan 24, 2016

Probably because the code where you did go get -u still had reference to the raphael repo. I would do this:

  1. Remove all the generated code directories (./app, ./swagger, etc.)
  2. Search and replace github.com/raphael with github.com/goadesign in all your files
  3. go get -u github.com/goadesign/goa/goagen
  4. For good measure (shouldn't be needed): rm -rf $GOPATH/src/github.com/raphael/goa

@KerwinKoo
Copy link
Author

It works after running go get -u github.com/goadesign/goa/goagen. Thank you @raphael .

But I still don't understand why created the raphael path, I never go get the goa package in raphael.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants