Minor golint cleanups.

This commit is contained in:
John C. Vernaleo 2014-09-05 13:44:04 -04:00
parent d6a4b89601
commit c630b6ca1f
3 changed files with 7 additions and 6 deletions

View file

@ -42,16 +42,16 @@ func TestJsonWithArgs(t *testing.T) {
return return
} }
// TestJsonRpcSend tests jsonRpcSend which actually send the rpc command. // TestJsonRPCSend tests jsonRPCSend which actually send the rpc command.
// This currently a negative test only until we setup a fake http server to // This currently a negative test only until we setup a fake http server to
// test the actually connection code. // test the actually connection code.
func TestJsonRpcSend(t *testing.T) { func TestJsonRPCSend(t *testing.T) {
// Just negative test right now. // Just negative test right now.
user := "something" user := "something"
password := "something" password := "something"
server := "invalid" server := "invalid"
var message []byte var message []byte
_, err := jsonRpcSend(user, password, server, message, false, nil, false) _, err := jsonRPCSend(user, password, server, message, false, nil, false)
if err == nil { if err == nil {
t.Errorf("Should fail when it cannot connect.") t.Errorf("Should fail when it cannot connect.")
} }

View file

@ -705,7 +705,7 @@ func rpcRawCommand(user string, password string, server string,
err := fmt.Errorf("error, message does not appear to be valid json: %v", err) err := fmt.Errorf("error, message does not appear to be valid json: %v", err)
return result, err return result, err
} }
resp, err := jsonRpcSend(user, password, server, message, https, resp, err := jsonRPCSend(user, password, server, message, https,
certificates, skipverify) certificates, skipverify)
if err != nil { if err != nil {
err := fmt.Errorf("error sending json message: " + err.Error()) err := fmt.Errorf("error sending json message: " + err.Error())

View file

@ -6,6 +6,7 @@ package btcjson
import ( import (
"bytes" "bytes"
// Need to import this size it registers hash we need.
_ "crypto/sha512" _ "crypto/sha512"
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
@ -31,11 +32,11 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) {
return msg, nil return msg, nil
} }
// jsonRpcSend connects to the daemon with the specified username, password, // jsonRPCSend connects to the daemon with the specified username, password,
// and ip/port and then send the supplied message. This uses net/http rather // and ip/port and then send the supplied message. This uses net/http rather
// than net/rpc/jsonrpc since that one doesn't support http connections and is // than net/rpc/jsonrpc since that one doesn't support http connections and is
// therefore useless. // therefore useless.
func jsonRpcSend(user string, password string, server string, message []byte, func jsonRPCSend(user string, password string, server string, message []byte,
https bool, certificates []byte, skipverify bool) (*http.Response, error) { https bool, certificates []byte, skipverify bool) (*http.Response, error) {
client := &http.Client{} client := &http.Client{}
protocol := "http" protocol := "http"