mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Task: Upgrade to Golang 1.9
This commit is contained in:
parent
cc7eb84388
commit
87b33e8603
@ -1,6 +1,6 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.7.x
|
||||
- 1.9.x
|
||||
script:
|
||||
- scripts/devtools.sh
|
||||
- make local build
|
||||
|
@ -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 \
|
||||
|
@ -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]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user