diff --git a/btcjson/v2/btcjson/cmdparse.go b/btcjson/v2/btcjson/cmdparse.go index fbd2a919..c48d06bb 100644 --- a/btcjson/v2/btcjson/cmdparse.go +++ b/btcjson/v2/btcjson/cmdparse.go @@ -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. diff --git a/btcjson/v2/btcjson/doc.go b/btcjson/v2/btcjson/doc.go index 6370fd75..54f549ea 100644 --- a/btcjson/v2/btcjson/doc.go +++ b/btcjson/v2/btcjson/doc.go @@ -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 diff --git a/btcjson/v2/btcjson/help.go b/btcjson/v2/btcjson/help.go index 80a66786..02fecac8 100644 --- a/btcjson/v2/btcjson/help.go +++ b/btcjson/v2/btcjson/help.go @@ -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: -// - "--synopsis" Synopsis for the command -// - "-" Description for each command argument -// - "-" Description for each object field -// - "--condition<#>" Description for each result condition -// - "--result<#>" Description for each primitive result num +// "--synopsis" Synopsis for the command +// "-" Description for each command argument +// "-" Description for each object field +// "--condition<#>" Description for each result condition +// "--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. diff --git a/btcjson/v2/btcjson/register.go b/btcjson/v2/btcjson/register.go index ac18ce0b..4986c937 100644 --- a/btcjson/v2/btcjson/register.go +++ b/btcjson/v2/btcjson/register.go @@ -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