Fix typo and clean up comments for godoc.

This commit is contained in:
Josh Rickmar 2015-04-17 18:10:15 -04:00
parent 5131b5e390
commit de12e101e1
4 changed files with 39 additions and 39 deletions

View file

@ -495,19 +495,19 @@ func assignField(paramNum int, fieldName string, dest reflect.Value, src reflect
// to be passed unaltered. In particular, the following conversions are
// supported:
//
// - Conversion between any size signed or unsigned integer so long as the value
// does not overflow the destination type
// - Conversion between float32 and float64 so long as the value does not
// overflow the destination type
// - Conversion from string to boolean for everything strconv.ParseBool
// recognizes
// - Conversion from string to any size integer for everything strconv.ParseInt
// and strconv.ParseUint recognizes
// - Conversion from string to any size float for everything strconv.ParseFloat
// recognizes
// - Conversion from string to arrays, slices, structs, and maps by treating
// the string as marshalled JSON and calling json.Unmarshal into the
// destination field
// - Conversion between any size signed or unsigned integer so long as the
// value does not overflow the destination type
// - Conversion between float32 and float64 so long as the value does not
// overflow the destination type
// - Conversion from string to boolean for everything strconv.ParseBool
// recognizes
// - Conversion from string to any size integer for everything
// strconv.ParseInt and strconv.ParseUint recognizes
// - Conversion from string to any size float for everything
// strconv.ParseFloat recognizes
// - Conversion from string to arrays, slices, structs, and maps by treating
// the string as marshalled JSON and calling json.Unmarshal into the
// destination field
func NewCmd(method string, args ...interface{}) (interface{}, error) {
// Look up details about the provided method. Any methods that aren't
// registered are an error.

View file

@ -72,7 +72,7 @@ This approach is used since it provides the caller with access to the additional
fields in the request that are not part of the command such as the ID.
Unmarshalling a received Response object is also a two step process:
1) Unmarhsal the raw bytes into a Response struct instance via json.Unmarshal
1) Unmarshal the raw bytes into a Response struct instance via json.Unmarshal
2) Depending on the ID, unmarshal the Result field of the unmarshalled
Response to create a concrete type instance

View file

@ -478,11 +478,11 @@ func isValidResultType(kind reflect.Kind) bool {
// an error will use the key in place of the description.
//
// The following outlines the required keys:
// - "<method>--synopsis" Synopsis for the command
// - "<method>-<lowerfieldname>" Description for each command argument
// - "<typename>-<lowerfieldname>" Description for each object field
// - "<method>--condition<#>" Description for each result condition
// - "<method>--result<#>" Description for each primitive result num
// "<method>--synopsis" Synopsis for the command
// "<method>-<lowerfieldname>" Description for each command argument
// "<typename>-<lowerfieldname>" Description for each object field
// "<method>--condition<#>" Description for each result condition
// "<method>--result<#>" Description for each primitive result num
//
// Notice that the "special" keys synopsis, condition<#>, and result<#> are
// preceded by a double dash to ensure they don't conflict with field names.
@ -493,17 +493,17 @@ func isValidResultType(kind reflect.Kind) bool {
//
// For example, consider the 'help' command itself. There are two possible
// returns depending on the provided parameters. So, the help would be
// generated by calling the function as follows
// generated by calling the function as follows:
// GenerateHelp("help", descs, (*string)(nil), (*string)(nil)).
//
// The following keys would then be required in the provided descriptions map:
//
// - "help--synopsis": "Returns a list of all commands or help for ...."
// - "help-command": "The command to retrieve help for",
// - "help--condition0": "no command provided"
// - "help--condition1": "command specified"
// - "help--result0": "List of commands"
// - "help--result1": "Help for specified command"
// "help--synopsis": "Returns a list of all commands or help for ...."
// "help-command": "The command to retrieve help for",
// "help--condition0": "no command provided"
// "help--condition1": "command specified"
// "help--result0": "List of commands"
// "help--result1": "Help for specified command"
func GenerateHelp(method string, descs map[string]string, resultTypes ...interface{}) (string, error) {
// Look up details about the provided method and error out if not
// registered.

View file

@ -136,19 +136,19 @@ func isAcceptableKind(kind reflect.Kind) bool {
// The type format is very strict since it needs to be able to automatically
// marshal to and from JSON-RPC 1.0. The following enumerates the requirements:
//
// - The provided command must be a single pointer to a struct
// - All fields must be exported
// - The order of the positional parameters in the marshalled JSON will be in
// the same order as declared in the struct definition
// - Struct embedding is not supported
// - Struct fields may NOT be channels, functions, complex, or interface
// - A field in the provided struct with a pointer is treated as optional
// - Multiple indirections (i.e **int) are not supported
// - Once the first optional field (pointer) is encountered, the remaining
// fields must also be optional fields (pointers) as required by positional
// params
// - A field that has a 'jsonrpcdefault' struct tag must be an optional field
// (pointer)
// - The provided command must be a single pointer to a struct
// - All fields must be exported
// - The order of the positional parameters in the marshalled JSON will be in
// the same order as declared in the struct definition
// - Struct embedding is not supported
// - Struct fields may NOT be channels, functions, complex, or interface
// - A field in the provided struct with a pointer is treated as optional
// - Multiple indirections (i.e **int) are not supported
// - Once the first optional field (pointer) is encountered, the remaining
// fields must also be optional fields (pointers) as required by positional
// params
// - A field that has a 'jsonrpcdefault' struct tag must be an optional field
// (pointer)
//
// NOTE: This function only needs to be able to examine the structure of the
// passed struct, so it does not need to be an actual instance. Therefore, it