This repository was archived by the owner on Sep 9, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ package gps
6
6
7
7
import (
8
8
"fmt"
9
- "sort"
10
9
11
10
"github.com/Masterminds/semver"
12
11
"github.com/golang/dep/gps/internal/pb"
@@ -375,7 +374,7 @@ func (m ProjectConstraints) overrideAll(pcm ProjectConstraints) (out []workingCo
375
374
k ++
376
375
}
377
376
378
- sort . SliceStable (out , func (i , j int ) bool {
377
+ sortSlice (out , func (i , j int ) bool {
379
378
return out [i ].Ident .Less (out [j ].Ident )
380
379
})
381
380
return
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ package gps
6
6
7
7
import (
8
8
"reflect"
9
- "sort"
10
9
"testing"
11
10
)
12
11
@@ -21,7 +20,7 @@ func TestLockedProjectSorting(t *testing.T) {
21
20
lps2 := make ([]LockedProject , len (lps ))
22
21
copy (lps2 , lps )
23
22
24
- sort . SliceStable (lps2 , func (i , j int ) bool {
23
+ sortSlice (lps2 , func (i , j int ) bool {
25
24
return lps2 [i ].Ident ().Less (lps2 [j ].Ident ())
26
25
})
27
26
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // +build go1.8
6
+
7
+ package gps
8
+
9
+ import "sort"
10
+
11
+ func sortSlice (slice interface {}, less func (i , j int ) bool ) {
12
+ sort .SliceStable (slice , less )
13
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // +build !go1.8
6
+
7
+ package gps
8
+
9
+ import "sort"
10
+
11
+ func sortSlice (slice interface {}, less func (i , j int ) bool ) {
12
+ sort .Slice (slice , less )
13
+ }
You can’t perform that action at this time.
0 commit comments