diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..046c4b1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +Contributing to Turnpike +=== + +Pull requests and bug reports are appreciated. + +Pull Requests +--- + +1. If you want to contribute a major feature or change, please open an issue to + discuss first. +2. Please run `go fmt` on your code +3. Check that `go tool vet ./` produces no warnings when run from the directory + where you made changes. +4. Write a test for any non-trivial changes. +5. Make sure all the tests pass. diff --git a/router_test.go b/router_test.go index f4948b1..86fe047 100644 --- a/router_test.go +++ b/router_test.go @@ -34,7 +34,7 @@ func basicConnect(t *testing.T, client *basicPeer, server Peer) Router { } if len(client.incoming) != 1 { - t.Fatal("Expected 1 message in the handshake, received %d", len(client.incoming)) + t.Fatalf("Expected 1 message in the handshake, received %d", len(client.incoming)) } if msg := <-client.incoming; msg.MessageType() != WELCOME { diff --git a/serialize_test.go b/serialize_test.go index 24fa57f..fdeab9d 100644 --- a/serialize_test.go +++ b/serialize_test.go @@ -30,9 +30,9 @@ func TestJSONDeserialize(t *testing.T) { s := new(JSONSerializer) for _, tst := range tests { if msg, err := s.Deserialize([]byte(tst.packet)); err != nil { - t.Error("Error parsing good packet: %s, %s", err, tst.packet) + t.Errorf("Error parsing good packet: %s, %s", err, tst.packet) } else if msg.MessageType() != tst.exp.MessageType() { - t.Error("Incorrect message type: %d != %d", msg.MessageType(), tst.exp.MessageType()) + t.Errorf("Incorrect message type: %d != %d", msg.MessageType(), tst.exp.MessageType()) } else if !reflect.DeepEqual(msg, tst.exp) { t.Errorf("%+v != %+v", msg, tst.exp) } @@ -79,7 +79,7 @@ func TestBinaryData(t *testing.T) { var b BinaryData err = json.Unmarshal(arr, &b) if err != nil { - t.Errorf("Error unmarshalling marshalled BinaryData:", err) + t.Errorf("Error unmarshalling marshalled BinaryData: %v", err) } else if !bytes.Equal([]byte(b), from) { t.Errorf("%s != %s", string(b), string(from)) } diff --git a/websocket.go b/websocket.go index f51e046..cb82cae 100644 --- a/websocket.go +++ b/websocket.go @@ -27,7 +27,7 @@ func NewWebsocketPeer(serialization Serialization, url, origin string) (Peer, er new(MessagePackSerializer), websocket.BinaryMessage, ) default: - return nil, fmt.Errorf("Unsupported serialization: %s", serialization) + return nil, fmt.Errorf("Unsupported serialization: %v", serialization) } }