Browse Source

Keep the continent map in the repository to avoid download on build.

Regularly check through CI cron job that it is the latest version.
pull/29/head
Joachim Bauch 7 months ago
parent
commit
7f92d105e5
Failed to extract signature
5 changed files with 274 additions and 3 deletions
  1. +0
    -1
      .gitignore
  2. +1
    -0
      .travis.yml
  3. +9
    -2
      Makefile
  4. +1
    -0
      scripts/get_continent_map.py
  5. +263
    -0
      src/signaling/continentmap.go

+ 0
- 1
.gitignore View File

@ -8,4 +8,3 @@ vendor/
cover.out
server.conf
src/signaling/continentmap.go

+ 1
- 0
.travis.yml View File

@ -19,6 +19,7 @@ cache:
install:
- make godeps
- make dependencies
- if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then make check-continentmap; fi
script:
- make client


+ 9
- 2
Makefile View File

@ -41,7 +41,7 @@ easyjson: dependencies
GOPATH=$(GOPATH) $(GO) get -d github.com/mailru/easyjson/...
GOPATH=$(GOPATH) $(GO) build -o ./vendor/bin/easyjson ./vendor/src/github.com/mailru/easyjson/easyjson/main.go
dependencies: hook godeps src/signaling/continentmap.go
dependencies: hook godeps
GOPATH=$(GOPATH) ./vendor/bin/godeps -u dependencies.tsv
dependencies.tsv: godeps
@ -55,6 +55,14 @@ dependencies.tsv: godeps
src/signaling/continentmap.go:
$(CURDIR)/scripts/get_continent_map.py $@
check-continentmap:
set -e ;\
TMP=$$(mktemp -d) ;\
echo Make sure to remove $$TMP on error ;\
$(CURDIR)/scripts/get_continent_map.py $$TMP/continentmap.go ;\
diff -u src/signaling/continentmap.go $$TMP/continentmap.go ;\
rm -rf $$TMP
get:
GOPATH=$(GOPATH) $(GO) get $(PACKAGE)
@ -98,7 +106,6 @@ server: dependencies common
clean:
rm -f src/signaling/*_easyjson.go
rm -f src/signaling/continentmap.go
build: server


+ 1
- 0
scripts/get_continent_map.py View File

@ -66,6 +66,7 @@ def generate_map(filename):
out.write('package signaling\n')
out.write('\n')
out.write('// This file has been automatically generated, do not modify.\n')
out.write('// Source: %s\n' % (URL))
out.write('\n')
out.write('var (\n')
out.write('\tContinentMap map[string][]string = map[string][]string{\n')


+ 263
- 0
src/signaling/continentmap.go View File

@ -0,0 +1,263 @@
package signaling
// This file has been automatically generated, do not modify.
// Source: https://datahub.io/JohnSnowLabs/country-and-continent-codes-list/r/country-and-continent-codes-list-csv.json
var (
ContinentMap map[string][]string = map[string][]string{
"AD": []string{"EU"},
"AE": []string{"AS"},
"AF": []string{"AS"},
"AG": []string{"NA"},
"AI": []string{"NA"},
"AL": []string{"EU"},
"AM": []string{"EU", "AS"},
"AN": []string{"NA"},
"AO": []string{"AF"},
"AQ": []string{"AN"},
"AR": []string{"SA"},
"AS": []string{"OC"},
"AT": []string{"EU"},
"AU": []string{"OC"},
"AW": []string{"NA"},
"AX": []string{"EU"},
"AZ": []string{"EU", "AS"},
"BA": []string{"EU"},
"BB": []string{"NA"},
"BD": []string{"AS"},
"BE": []string{"EU"},
"BF": []string{"AF"},
"BG": []string{"EU"},
"BH": []string{"AS"},
"BI": []string{"AF"},
"BJ": []string{"AF"},
"BL": []string{"NA"},
"BM": []string{"NA"},
"BN": []string{"AS"},
"BO": []string{"SA"},
"BQ": []string{"NA"},
"BR": []string{"SA"},
"BS": []string{"NA"},
"BT": []string{"AS"},
"BV": []string{"AN"},
"BW": []string{"AF"},
"BY": []string{"EU"},
"BZ": []string{"NA"},
"CA": []string{"NA"},
"CC": []string{"AS"},
"CD": []string{"AF"},
"CF": []string{"AF"},
"CG": []string{"AF"},
"CH": []string{"EU"},
"CI": []string{"AF"},
"CK": []string{"OC"},
"CL": []string{"SA"},
"CM": []string{"AF"},
"CN": []string{"AS"},
"CO": []string{"SA"},
"CR": []string{"NA"},
"CU": []string{"NA"},
"CV": []string{"AF"},
"CW": []string{"NA"},
"CX": []string{"AS"},
"CY": []string{"EU", "AS"},
"CZ": []string{"EU"},
"DE": []string{"EU"},
"DJ": []string{"AF"},
"DK": []string{"EU"},
"DM": []string{"NA"},
"DO": []string{"NA"},
"DZ": []string{"AF"},
"EC": []string{"SA"},
"EE": []string{"EU"},
"EG": []string{"AF"},
"EH": []string{"AF"},
"ER": []string{"AF"},
"ES": []string{"EU"},
"ET": []string{"AF"},
"FI": []string{"EU"},
"FJ": []string{"OC"},
"FK": []string{"SA"},
"FM": []string{"OC"},
"FO": []string{"EU"},
"FR": []string{"EU"},
"GA": []string{"AF"},
"GB": []string{"EU"},
"GD": []string{"NA"},
"GE": []string{"EU", "AS"},
"GF": []string{"SA"},
"GG": []string{"EU"},
"GH": []string{"AF"},
"GI": []string{"EU"},
"GL": []string{"NA"},
"GM": []string{"AF"},
"GN": []string{"AF"},
"GP": []string{"NA"},
"GQ": []string{"AF"},
"GR": []string{"EU"},
"GS": []string{"AN"},
"GT": []string{"NA"},
"GU": []string{"OC"},
"GW": []string{"AF"},
"GY": []string{"SA"},
"HK": []string{"AS"},
"HM": []string{"AN"},
"HN": []string{"NA"},
"HR": []string{"EU"},
"HT": []string{"NA"},
"HU": []string{"EU"},
"ID": []string{"AS"},
"IE": []string{"EU"},
"IL": []string{"AS"},
"IM": []string{"EU"},
"IN": []string{"AS"},
"IO": []string{"AS"},
"IQ": []string{"AS"},
"IR": []string{"AS"},
"IS": []string{"EU"},
"IT": []string{"EU"},
"JE": []string{"EU"},
"JM": []string{"NA"},
"JO": []string{"AS"},
"JP": []string{"AS"},
"KE": []string{"AF"},
"KG": []string{"AS"},
"KH": []string{"AS"},
"KI": []string{"OC"},
"KM": []string{"AF"},
"KN": []string{"NA"},
"KP": []string{"AS"},
"KR": []string{"AS"},
"KW": []string{"AS"},
"KY": []string{"NA"},
"KZ": []string{"EU", "AS"},
"LA": []string{"AS"},
"LB": []string{"AS"},
"LC": []string{"NA"},
"LI": []string{"EU"},
"LK": []string{"AS"},
"LR": []string{"AF"},
"LS": []string{"AF"},
"LT": []string{"EU"},
"LU": []string{"EU"},
"LV": []string{"EU"},
"LY": []string{"AF"},
"MA": []string{"AF"},
"MC": []string{"EU"},
"MD": []string{"EU"},
"ME": []string{"EU"},
"MF": []string{"NA"},
"MG": []string{"AF"},
"MH": []string{"OC"},
"MK": []string{"EU"},
"ML": []string{"AF"},
"MM": []string{"AS"},
"MN": []string{"AS"},
"MO": []string{"AS"},
"MP": []string{"OC"},
"MQ": []string{"NA"},
"MR": []string{"AF"},
"MS": []string{"NA"},
"MT": []string{"EU"},
"MU": []string{"AF"},
"MV": []string{"AS"},
"MW": []string{"AF"},
"MX": []string{"NA"},
"MY": []string{"AS"},
"MZ": []string{"AF"},
"NA": []string{"AF"},
"NC": []string{"OC"},
"NE": []string{"AF"},
"NF": []string{"OC"},
"NG": []string{"AF"},
"NI": []string{"NA"},
"NL": []string{"EU"},
"NO": []string{"EU"},
"NP": []string{"AS"},
"NR": []string{"OC"},
"NU": []string{"OC"},
"NZ": []string{"OC"},
"OM": []string{"AS"},
"PA": []string{"NA"},
"PE": []string{"SA"},
"PF": []string{"OC"},
"PG": []string{"OC"},
"PH": []string{"AS"},
"PK": []string{"AS"},
"PL": []string{"EU"},
"PM": []string{"NA"},
"PN": []string{"OC"},
"PR": []string{"NA"},
"PS": []string{"AS"},
"PT": []string{"EU"},
"PW": []string{"OC"},
"PY": []string{"SA"},
"QA": []string{"AS"},
"RE": []string{"AF"},
"RO": []string{"EU"},
"RS": []string{"EU"},
"RU": []string{"EU", "AS"},
"RW": []string{"AF"},
"SA": []string{"AS"},
"SB": []string{"OC"},
"SC": []string{"AF"},
"SD": []string{"AF"},
"SE": []string{"EU"},
"SG": []string{"AS"},
"SH": []string{"AF"},
"SI": []string{"EU"},
"SJ": []string{"EU"},
"SK": []string{"EU"},
"SL": []string{"AF"},
"SM": []string{"EU"},
"SN": []string{"AF"},
"SO": []string{"AF"},
"SR": []string{"SA"},
"SS": []string{"AF"},
"ST": []string{"AF"},
"SV": []string{"NA"},
"SX": []string{"NA"},
"SY": []string{"AS"},
"SZ": []string{"AF"},
"TC": []string{"NA"},
"TD": []string{"AF"},
"TF": []string{"AN"},
"TG": []string{"AF"},
"TH": []string{"AS"},
"TJ": []string{"AS"},
"TK": []string{"OC"},
"TL": []string{"AS"},
"TM": []string{"AS"},
"TN": []string{"AF"},
"TO": []string{"OC"},
"TR": []string{"EU", "AS"},
"TT": []string{"NA"},
"TV": []string{"OC"},
"TW": []string{"AS"},
"TZ": []string{"AF"},
"UA": []string{"EU"},
"UG": []string{"AF"},
"UM": []string{"OC", "NA"},
"US": []string{"NA"},
"UY": []string{"SA"},
"UZ": []string{"AS"},
"VA": []string{"EU"},
"VC": []string{"NA"},
"VE": []string{"SA"},
"VG": []string{"NA"},
"VI": []string{"NA"},
"VN": []string{"AS"},
"VU": []string{"OC"},
"WF": []string{"OC"},
"WS": []string{"OC"},
"XD": []string{"AS"},
"XE": []string{"AS"},
"XS": []string{"AS"},
"XX": []string{"OC"},
"YE": []string{"AS"},
"YT": []string{"AF"},
"ZA": []string{"AF"},
"ZM": []string{"AF"},
"ZW": []string{"AF"},
}
)

Loading…
Cancel
Save