Unfortunately, a "normal assumption" would probably be that "This is all a golang script, so the execution shouldn't be affected by local environment variances." So without this requirement documented clearly then we can encounter unexpected behavior explained by "well it works on my machine".
This was all learned in a first hand experience based on PRs I was working on last friday. We were seeing that even if I made no changes at all and ran make charts then it would results in file modifications. Eventually it was all tracked down to the fact that on macOS they ship with a BSD based "Apple" version of diff and patch. See:
→ patch --version
patch 2.0-12u11-Apple
→ diff --version
Apple diff (based on FreeBSD diff)
After using brew to install gpatch and diffutils packages I have GNU versions and get expected results:
The functionality of generating and applying the diff patches are dependent on local system
diff
andpatch
binaries.Per these lines:
https://github.com/rancher/charts-build-scripts/blob/a7001e331fda7b61c8df358862f46436eaae9df2/pkg/diff/diff.go#L19 https://github.com/rancher/charts-build-scripts/blob/a7001e331fda7b61c8df358862f46436eaae9df2/pkg/diff/diff.go#L57
Unfortunately, a "normal assumption" would probably be that "This is all a golang script, so the execution shouldn't be affected by local environment variances." So without this requirement documented clearly then we can encounter unexpected behavior explained by "well it works on my machine".
This was all learned in a first hand experience based on PRs I was working on last friday. We were seeing that even if I made no changes at all and ran
make charts
then it would results in file modifications. Eventually it was all tracked down to the fact that on macOS they ship with a BSD based "Apple" version ofdiff
andpatch
. See:After using brew to install
gpatch
anddiffutils
packages I have GNU versions and get expected results: