mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-12 19:25:37 +00:00
Task: Upgrade to Golang 1.9
This commit is contained in:
parent
cc7eb84388
commit
87b33e8603
@ -1,6 +1,6 @@
|
|||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- 1.7.x
|
- 1.9.x
|
||||||
script:
|
script:
|
||||||
- scripts/devtools.sh
|
- scripts/devtools.sh
|
||||||
- make local build
|
- make local build
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.7
|
FROM golang:1.9
|
||||||
|
|
||||||
COPY scripts/devtools.sh /opt/devtools.sh
|
COPY scripts/devtools.sh /opt/devtools.sh
|
||||||
|
|
||||||
@ -14,6 +14,8 @@ RUN set -ex \
|
|||||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||||
$buildDeps \
|
$buildDeps \
|
||||||
python2.7 \
|
python2.7 \
|
||||||
|
python-setuptools \
|
||||||
|
python-wheel \
|
||||||
python-pip \
|
python-pip \
|
||||||
&& pip install --upgrade \
|
&& pip install --upgrade \
|
||||||
pip \
|
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
|
// because the parsing of the yaml was done via a map the order will be inconsistent
|
||||||
// apply order to allow a consistent output
|
// 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.(string) < mapSlice[j].Key.(string) })
|
||||||
// sort.SliceStable(mapSlice, func(i, j int) bool { return mapSlice[i].Key < mapSlice[j].Key })
|
|
||||||
sort.Sort(sortMap{mapSlice})
|
|
||||||
return mapSlice
|
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