Hi guys I was wondering…

2 minute read

Hi guys, I was wondering if any of you have experience or advice to apply the nx cli in a monorepo to include projects in none js/ts language? in our case the repo includes a microservice part written in golang.

My idea is to use schematics to scaffold those microservices (should be language indepenent) but to also leverage from nx affected command in order to execute tasks for those microservices. So i guess my question is: can I setup the angular.json/nx.json files so this would work? I guess nx affected takes the project root from angular.json in order to git compare files in it?

Responses:

obviously being able to use the dep-graph for the service mesh would add even more value

https://nrwlcommunity.slack.com/archives/CMFKWPU6Q/p1582736908030500?thread_ts=1582219805.140400

I don’t know of anyone trying to incorporate Go, but this Java PoC should work in a similar way.

Great, schematics + nx is hands down the best thing

this is exactly how I imagined it would work

the main thing you lose when you add a different language is that you have to manually create the dependency links between those projects

Nx only follows js/ts import statements to know how your projects actually depend on each other

yes, I assumed that this is necessary, but thats a one time thing

If you wanted I’m sure you could even write your own builders so that you can run ng build on your Go app. Ng build would then just call whatever it is that you use to.build go apps.

yes, this is what I have in mind.

the downside is that in the docker environment of the go microservices, we also need nodejs

Why would you need node is the environment that the go microservices is running in?

Would you just need it during build time?

(I also know nothing about Go)

yes, but building is also done in docker images, at least thats the way it is currently setup

I know nothing about go either :joy:

Ah gotcha ok, ya we do our building in a docker container that’s meant for building then use those artifacts and build from a different image and deploy that image.

Then you only need production dependencies in the container that is being deployed

yes we actually do exactly this for the UI part everything is setup very professionally whereas the backend part is straight up ugly :slightly_smiling_face:

Maybe it’s time to switch it up a bit! You’ll thank yourself in the long run!

I know…. just have to convince those backend guys

Good luck! They (we) are stubborn

they say “something like nx is not available for go”… now I tell them to just use nx then

Well you have the proof that it’s possible now.

yes, will probably have to implement a poc for them, but thats going to be doable

Hi https://app.slack.com/team/UV20HANER|Christian Taepper I was wondering if you got around to implementing the POC for golang? and have any recommendations for me

and I totally forgot about this convo and started implementing a Go plugin for nx that will support building serving and testing (with affected support this will need some more thought though but I have an idea of how to do it). Christian, where did you get with your poc?

any code samples or plugin url?

Haven’t pushed anything yet but I want to work on it more this weekend and maybe get a poc out

Updated: