Make diff result as deterministic as possible (#231)
Make diff result as deterministic as possible (#231)

`helm diff upgrade` output is non-deterministic, due to that it shows diff entry in the order of the Go map objects containing source/target manifests to be compared.

The non-determinism makes writing integration test with something and helm-diff harder, as snapshot testing is impossible.

This patch fixes it by enhancing the diff logic to sort those map keys in alphabetical order and use the result for iterating map entries.

Note that you can use the below snippet for non-scientific testing to verify that the result is (seemingly) deterministic now:

```
for (( i=0; i<10; ++i)); do helm --debug diff upgrade --dry-run foo stable/prometheus-operator | sha256sum ; done
```

Before this change it should print output like:

```
$ for (( i=0; i<10; ++i)); do helm --debug diff upgrade --dry-run foo stable/prometheus-operator | sha256sum ; done
754f01763544baeb4f405ccdcdf7ffd9075bfddf9777a993f1e787ea6096b0b4  -
88a5f76e3802e0e4693fe007d4ae6fc8c3ae5cf97b7244dc67e45a282385e2c3  -
b57e66a22c49ec2a29dacc9e912a313aca85b403ac3d2960fc0afddeda544a77  -
769c605ea8c13f4251559948260f8c6104d821ce79de1367d2a6ee477be37777  -
afce52fa595beaf106303ae162efb4f31a7336c84a630b1d4ea1e59ba1468292  -
12a3b3c1e3fdcd0b4b62517583135abe20249d69e6c4aed9acfab7c999771bdd  -
294d5db8edec946737036014b549baa93601aadf430f1b80517db9eca2dd1330  -
31860127c9ae69e5d0154b60cc7ea05e992bac54e1453c88198940e719552f72  -
dce05e1932ca7d6e15416de3b0a891ae68e3c885247f683fe50068b2c551213b  -
f0101d6e952fd0344d9e45518254cb3e0692156becaae106fcc7b1dae273ac04  -
```

After the change it should be like:

```
$ make build install/helm3
$ for (( i=0; i<10; ++i)); do helm --debug diff upgrade --dry-run foo stable/prometheus-operator | sha256sum ; done
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
ee4e79f6adee9e2606c9d855949afd39cf5a13a650cb55a3d74184c7edaf956d  -
```
databus23/helm-diff,databus23/helm-diff