Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile to build Golang projects that can be used without putting the | |
# makefile in the project directory. Using make to build & run go projects | |
# allows you to reuse build output when files haven't changed, considering | |
# building go can be slow. | |
# | |
# Based On: https://ariejan.net/2015/10/03/a-makefile-for-golang-cli-tools/ | |
# | |
# By default it builds main.go from the directory you're in, to a binary | |
# called main. To amke it easier to use, set bash aliases & functions: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def diff_data(d1, d2, d1_name='d1', d2_name='d2'): | |
"""Return fields in one but not the other, or None if they're the same. | |
""" | |
if d1 == d2: | |
return None | |
elif type(d1) != type(d2): | |
return {d1_name: d1, d2_name: d2} | |
elif isinstance(d1, dict): | |
diff = {} | |
for key, v1 in d1.iteritems(): |