Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use built-in less than operator instead of strings.Compare #330

Merged
merged 1 commit into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/enum_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (cfg *Config) buildEnums(types NamedTypes) []Enum {
}

sort.Slice(enums, func(i, j int) bool {
return strings.Compare(enums[i].GQLType, enums[j].GQLType) == -1
return enums[i].GQLType < enums[j].GQLType
})

return enums
Expand Down
3 changes: 1 addition & 2 deletions codegen/input_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package codegen
import (
"go/types"
"sort"
"strings"

"github.com/pkg/errors"
"github.com/vektah/gqlparser/ast"
Expand Down Expand Up @@ -38,7 +37,7 @@ func (cfg *Config) buildInputs(namedTypes NamedTypes, prog *loader.Program, impo
}

sort.Slice(inputs, func(i, j int) bool {
return strings.Compare(inputs[i].GQLType, inputs[j].GQLType) == -1
return inputs[i].GQLType < inputs[j].GQLType
})

return inputs, nil
Expand Down
3 changes: 1 addition & 2 deletions codegen/interface_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"go/types"
"os"
"sort"
"strings"

"github.com/vektah/gqlparser/ast"
"golang.org/x/tools/go/loader"
Expand All @@ -20,7 +19,7 @@ func (cfg *Config) buildInterfaces(types NamedTypes, prog *loader.Program) []*In
}

sort.Slice(interfaces, func(i, j int) bool {
return strings.Compare(interfaces[i].GQLType, interfaces[j].GQLType) == -1
return interfaces[i].GQLType < interfaces[j].GQLType
})

return interfaces
Expand Down
3 changes: 1 addition & 2 deletions codegen/models_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package codegen

import (
"sort"
"strings"

"github.com/vektah/gqlparser/ast"
"golang.org/x/tools/go/loader"
Expand Down Expand Up @@ -47,7 +46,7 @@ func (cfg *Config) buildModels(types NamedTypes, prog *loader.Program, imports *
}

sort.Slice(models, func(i, j int) bool {
return strings.Compare(models[i].GQLType, models[j].GQLType) == -1
return models[i].GQLType < models[j].GQLType
})

return models, nil
Expand Down
3 changes: 1 addition & 2 deletions codegen/object_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package codegen
import (
"log"
"sort"
"strings"

"github.com/pkg/errors"
"github.com/vektah/gqlparser/ast"
Expand Down Expand Up @@ -38,7 +37,7 @@ func (cfg *Config) buildObjects(types NamedTypes, prog *loader.Program, imports
}

sort.Slice(objects, func(i, j int) bool {
return strings.Compare(objects[i].GQLType, objects[j].GQLType) == -1
return objects[i].GQLType < objects[j].GQLType
})

return objects, nil
Expand Down