This repository was archived by the owner on Sep 9, 2020. It is now read-only.
File tree 2 files changed +27
-4
lines changed
2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package dep
6
6
7
7
import (
8
8
"io"
9
+ "sort"
9
10
10
11
"github.com/pelletier/go-toml"
11
12
"github.com/pkg/errors"
@@ -128,12 +129,34 @@ func (m *Manifest) toRaw() rawManifest {
128
129
for n , prj := range m .Dependencies {
129
130
raw .Dependencies = append (raw .Dependencies , toRawProject (n , prj ))
130
131
}
132
+ sort .Sort (sortedRawProjects (raw .Dependencies ))
133
+
131
134
for n , prj := range m .Ovr {
132
135
raw .Overrides = append (raw .Overrides , toRawProject (n , prj ))
133
136
}
137
+ sort .Sort (sortedRawProjects (raw .Overrides ))
138
+
134
139
return raw
135
140
}
136
141
142
+ // TODO(carolynvs) when gps is moved, we can use the unexported gps.sortedConstraints
143
+ type sortedRawProjects []rawProject
144
+
145
+ func (s sortedRawProjects ) Len () int { return len (s ) }
146
+ func (s sortedRawProjects ) Swap (i , j int ) { s [i ], s [j ] = s [j ], s [i ] }
147
+ func (s sortedRawProjects ) Less (i , j int ) bool {
148
+ l , r := s [i ], s [j ]
149
+
150
+ if l .Name < r .Name {
151
+ return true
152
+ }
153
+ if r .Name < l .Name {
154
+ return false
155
+ }
156
+
157
+ return l .Source < r .Source
158
+ }
159
+
137
160
func (m * Manifest ) MarshalTOML () (string , error ) {
138
161
raw := m .toRaw ()
139
162
Original file line number Diff line number Diff line change 1
1
ignores = [" github.com/foo/bar" ]
2
2
3
- [[dependencies ]]
4
- name = " github.com/sdboyer/gps"
5
- version = " >=0.12.0, <1.0.0"
6
-
7
3
[[dependencies ]]
8
4
name = " github.com/babble/brook"
9
5
revision = " d05d5aca9f895d19e9265839bffeadd74a2d2ecb"
10
6
7
+ [[dependencies ]]
8
+ name = " github.com/sdboyer/gps"
9
+ version = " >=0.12.0, <1.0.0"
10
+
11
11
[[overrides ]]
12
12
branch = " master"
13
13
name = " github.com/sdboyer/gps"
You can’t perform that action at this time.
0 commit comments