如何在地球上找到两条线(geojson的线串)之间的距离

How can I find the smallest distance between two lines on Earth if I have their latitudes and longitudes? Preference to golang, but it'll be cool in an any programming language

I really tried to find it, but I can only find how to do it for two points

So, I do this I have two lines AB and CD I find distance from point A to line CD, from point C to CD, from point C to line AB, from point D to line AB Put it all into array and after than find the smallest distance

(if line lines do not intersect or parallel, i'll put this cases into special condition)