~egtann/lanhttp

16c04151cff34aca6d5039a6b9ce2f6199ddb165 — Evan Tann 1 year, 2 months ago 27b8b2e
fix bug in the services diff function
1 files changed, 14 insertions(+), 1 deletions(-)

M lanhttp.go
M lanhttp.go => lanhttp.go +14 -1
@@ 228,8 228,13 @@ func (c *Client) Routes() Routes {
}

func diff(a, b Routes) bool {
	// Exit quickly if lengths are different
	if len(a) != len(b) {
		return true
	}

	// Iterate through every key in a and determine if all values match
	for key := range a {
		// Exit quickly if lengths are different
		if len(a[key]) != len(b[key]) {
			return true
		}


@@ 250,5 255,13 @@ func diff(a, b Routes) bool {
			}
		}
	}

	// We also need to check that there are no keys in b which don't exist
	// in a, which aren't checked in the range loop above
	for key := range b {
		if _, ok := a[key]; !ok {
			return true
		}
	}
	return false
}