Code Monkey home page Code Monkey logo

Comments (9)

cf-gitbot avatar cf-gitbot commented on August 21, 2024

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

from brokerapi.

rlk833 avatar rlk833 commented on August 21, 2024

We use an automated deploy and build for all of our go code. So the suggestion I've seen in other locations for exposed vendored api is not really workable. The workaround is to manually delete the vendored package out of brokerapi after download it. This would be a big pain in our automated process. Everything is just go get and then build.

from brokerapi.

nodo avatar nodo commented on August 21, 2024

Hi @rlk833. We could certainly remove vendoring for 3rd party libraries in brokerapi. However, is that what you really need? You will still need to use the gorilla/mux router created in New() or pass one in using AttachRoutes(). Currently we don't support other router other than mux.Router.

from brokerapi.

rlk833 avatar rlk833 commented on August 21, 2024

The problem is I can't pass in gorilla/mux router because GO won't accept it. The problem is because you vendor it, GO will only accept a mux router that is created through your internal vendored packaged. But since it is internal vendored I can't create such an instance because that package is hidden. It is a catch-22. Same goes for lager logger.

Anything that you expose as a parameter in the API must be for packages that are not vendored. Otherwise it is impossible to call your API since we can't create objects of the internal vendored type.

from brokerapi.

nodo avatar nodo commented on August 21, 2024

Thanks for your quick response.

I am not sure I understand. Please can you give us an example of your code?

You can see how we use the brokerapi package here: https://github.com/pivotal-cf/on-demand-service-broker/blob/master/apiserver/apiserver.go#L45. As you can see we are passing a mux.Router created at line 43.

from brokerapi.

rlk833 avatar rlk833 commented on August 21, 2024

The problem is this: I have a router from package

"github.com/gorilla/mux"

.

But the router GO thinks you expose in the API is

"github.com/pivotal-cf/brokerapi/vendor/github.com/gorilla/mux"

This is a completely different package to Go. They are not compatible. I can't pass an instance of my router because it is not of the type of your router.

GO will not let me create a router of an internal vender package like that. And you wouldn't want too either because then I would have to use your internal router everywhere else in my code.

I don't know why your GO is not complaining. Mine is, GO 1.9

your on-demand vendor folder contains brokerapi, but the brokerapi that was vendored DID NOT INCLUDE a vendor folder itself. However doing straight normal go get -d ./... on my code GO pulls your brokerapi AND pulls the packaged vendor folder under brokerapi. This is what causes the conflict. We can't develop because of this.

from brokerapi.

rlk833 avatar rlk833 commented on August 21, 2024

Vendor is typically not used on packages which are meant to be used by someone else. They are typically only used for:
a) top level applications that are not included somewhere else
b) internal imported packages that you want to lock down on a version

Any package meant to be imported somewhere else should not vendor any exposed internal vendored packages.

from brokerapi.

nodo avatar nodo commented on August 21, 2024

Hey @rlk833,

Fair enough, we have updated brokerapi to not commit the vendor folder. We have also tried to use it as a library and it seems to work now.

Please, let us now if it works for you.

Thanks!

@nodo and @terminatingcode

from brokerapi.

rlk833 avatar rlk833 commented on August 21, 2024

Thanks @nodo, that worked great.

from brokerapi.

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.