Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

Commit

Permalink
Fix golint warnings
Browse files Browse the repository at this point in the history
- The ones left are "uncommented exported func/var/methods etc"
  • Loading branch information
sogko committed Apr 15, 2016
1 parent ca6839e commit 9b137fd
Show file tree
Hide file tree
Showing 11 changed files with 405 additions and 510 deletions.
370 changes: 184 additions & 186 deletions definition.go

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions directives.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package graphql

// Directive structs are used by the GraphQL runtime as a way of modifying execution
// behavior. Type system creators will usually not create these directly.
type Directive struct {
Name string `json:"name"`
Description string `json:"description"`
Expand All @@ -9,10 +11,6 @@ type Directive struct {
OnField bool `json:"onField"`
}

/**
* Directives are used by the GraphQL runtime as a way of modifying execution
* behavior. Type system creators will usually not create these directly.
*/
func NewDirective(config *Directive) *Directive {
if config == nil {
config = &Directive{}
Expand All @@ -27,10 +25,8 @@ func NewDirective(config *Directive) *Directive {
}
}

/**
* Used to conditionally include fields or fragments
*/
var IncludeDirective *Directive = NewDirective(&Directive{
// IncludeDirective is used to conditionally include fields or fragments
var IncludeDirective = NewDirective(&Directive{
Name: "include",
Description: "Directs the executor to include this field or fragment only when " +
"the `if` argument is true.",
Expand All @@ -46,10 +42,8 @@ var IncludeDirective *Directive = NewDirective(&Directive{
OnField: true,
})

/**
* Used to conditionally skip (exclude) fields or fragments
*/
var SkipDirective *Directive = NewDirective(&Directive{
// SkipDirective Used to conditionally skip (exclude) fields or fragments
var SkipDirective = NewDirective(&Directive{
Name: "skip",
Description: "Directs the executor to skip this field or fragment when the `if` " +
"argument is true.",
Expand Down
33 changes: 14 additions & 19 deletions executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ func buildExecutionContext(p BuildExecutionCtxParams) (*ExecutionContext, error)
if operation == nil {
if p.OperationName == "" {
return nil, fmt.Errorf(`Unknown operation named "%v".`, p.OperationName)
} else {
return nil, fmt.Errorf(`Must provide an operation`)
}
return nil, fmt.Errorf(`Must provide an operation`)
}

variableValues, err := getVariableValues(p.Schema, operation.GetVariableDefinitions(), p.Args)
Expand Down Expand Up @@ -156,9 +155,9 @@ func executeOperation(p ExecuteOperationParams) *Result {

if p.Operation.GetOperation() == "mutation" {
return executeFieldsSerially(executeFieldsParams)
} else {
return executeFields(executeFieldsParams)
}
return executeFields(executeFieldsParams)

}

// Extracts the root type of the operation from the schema.
Expand Down Expand Up @@ -470,12 +469,10 @@ type resolveFieldResultState struct {
hasNoFieldDefs bool
}

/**
* Resolves the field on the given source object. In particular, this
* figures out the value that the field returns by calling its resolve function,
* then calls completeValue to complete promises, serialize scalars, or execute
* the sub-selection-set for objects.
*/
// Resolves the field on the given source object. In particular, this
// figures out the value that the field returns by calling its resolve function,
// then calls completeValue to complete promises, serialize scalars, or execute
// the sub-selection-set for objects.
func resolveField(eCtx *ExecutionContext, parentType *Object, source interface{}, fieldASTs []*ast.Field) (result interface{}, resultState resolveFieldResultState) {
// catch panic from resolveFn
var returnType Output
Expand Down Expand Up @@ -771,15 +768,13 @@ func defaultResolveFn(p ResolveParams) (interface{}, error) {
return nil, nil
}

/**
* This method looks up the field on the given type defintion.
* It has special casing for the two introspection fields, __schema
* and __typename. __typename is special because it can always be
* queried as a field, even in situations where no other fields
* are allowed, like on a Union. __schema could get automatically
* added to the query type, but that would require mutating type
* definitions, which would cause issues.
*/
// This method looks up the field on the given type defintion.
// It has special casing for the two introspection fields, __schema
// and __typename. __typename is special because it can always be
// queried as a field, even in situations where no other fields
// are allowed, like on a Union. __schema could get automatically
// added to the query type, but that would require mutating type
// definitions, which would cause issues.
func getFieldDef(schema Schema, parentType *Object, fieldName string) *FieldDefinition {

if parentType == nil {
Expand Down
Loading

0 comments on commit 9b137fd

Please sign in to comment.