Task: Upgrade to Golang 1.9

This commit is contained in:
kenjones 2017-09-27 07:05:18 -04:00
parent cc7eb84388
commit 87b33e8603
3 changed files with 5 additions and 21 deletions

View File

@ -1,6 +1,6 @@
language: go
go:
- 1.7.x
- 1.9.x
script:
- scripts/devtools.sh
- make local build

View File

@ -1,4 +1,4 @@
FROM golang:1.7
FROM golang:1.9
COPY scripts/devtools.sh /opt/devtools.sh
@ -14,6 +14,8 @@ RUN set -ex \
&& apt-get update && apt-get install -y --no-install-recommends \
$buildDeps \
python2.7 \
python-setuptools \
python-wheel \
python-pip \
&& pip install --upgrade \
pip \

View File

@ -196,24 +196,6 @@ func mapToMapSlice(data map[interface{}]interface{}) yaml.MapSlice {
// because the parsing of the yaml was done via a map the order will be inconsistent
// apply order to allow a consistent output
// Only available in Go 1.8+
// sort.SliceStable(mapSlice, func(i, j int) bool { return mapSlice[i].Key < mapSlice[j].Key })
sort.Sort(sortMap{mapSlice})
sort.SliceStable(mapSlice, func(i, j int) bool { return mapSlice[i].Key.(string) < mapSlice[j].Key.(string) })
return mapSlice
}
type sortMap struct {
ms yaml.MapSlice
}
func (m sortMap) Len() int {
return len(m.ms)
}
func (m sortMap) Less(i, j int) bool {
return m.ms[i].Key.(string) < m.ms[j].Key.(string)
}
func (m sortMap) Swap(i, j int) {
m.ms[i], m.ms[j] = m.ms[j], m.ms[i]
}