code: func UniqueVariableNamesRule(context *ValidationContext) *ValidationRuleInstance {
  	knownVariableNames := map[string]*ast.Name{}
  
  	visitorOpts := &visitor.VisitorOptions{
  		KindFuncMap: map[string]visitor.NamedVisitFuncs{
  			kinds.OperationDefinition: {
  				Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
  					if node, ok := p.Node.(*ast.OperationDefinition); ok && node != nil {
  						knownVariableNames = map[string]*ast.Name{}
  					}
  					return visitor.ActionNoChange, nil
  				},
  			},
  			kinds.VariableDefinition: {
  				Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
  					if node, ok := p.Node.(*ast.VariableDefinition); ok && node != nil {
  						variableName := ""
  						var variableNameAST *ast.Name
  						if node.Variable != nil && node.Variable.Name != nil {
  							variableNameAST = node.Variable.Name
  							variableName = node.Variable.Name.Value
  						}
  						if nameAST, ok := knownVariableNames[variableName]; ok {
  							reportError(
  								context,
  								fmt.Sprintf(`There can only be one variable named "%v".`, variableName),
  								[]ast.Node{nameAST, variableNameAST},
  							)
  						} else {
  							knownVariableNames[variableName] = variableNameAST
  						}
  					}
  					return visitor.ActionNoChange, nil
  				},
  			},
  		},
  	}
  	return &ValidationRuleInstance{
  		VisitorOpts: visitorOpts,
  	}
  }
docs: // UniqueVariableNamesRule Unique variable names
  //
  // A GraphQL operation is only valid if all its variables are uniquely named.