good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 00ca8feb authored by Anmol Sethi's avatar Anmol Sethi
Browse files

Ensure CI is satisfied

parent 5dfbefb6
No related merge requests found
......@@ -8,7 +8,7 @@ gen() {
go list ./... > /dev/null
go mod tidy
go install github.com/golang/protobuf/protoc-gen-go
go install golang.org/x/tools/cmd/stringer
go generate ./...
}
......
workflow "main" {
on = "push"
resolves = ["fmt", "test"]
resolves = ["fmt", "lint", "test"]
}
action "lint" {
uses = "./.github/lint"
}
action "fmt" {
......
......@@ -8,6 +8,7 @@ import (
//go:generate stringer -type=DataType
type DataType int
// DataType constants.
const (
Text DataType = DataType(wscore.OpText)
Binary DataType = DataType(wscore.OpBinary)
......
......@@ -4,14 +4,22 @@ package ws
import "strconv"
const _DataFrame_name = "TextBinary"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[Text-1]
_ = x[Binary-2]
}
const _DataType_name = "TextBinary"
var _DataFrame_index = [...]uint8{0, 4, 10}
var _DataType_index = [...]uint8{0, 4, 10}
func (i DataType) String() string {
i -= 1
if i < 0 || i >= DataType(len(_DataFrame_index)-1) {
if i < 0 || i >= DataType(len(_DataType_index)-1) {
return "DataType(" + strconv.FormatInt(int64(i+1), 10) + ")"
}
return _DataFrame_name[_DataFrame_index[i]:_DataFrame_index[i+1]]
return _DataType_name[_DataType_index[i]:_DataType_index[i+1]]
}
......@@ -8,11 +8,12 @@ import (
"time"
"golang.org/x/time/rate"
"nhooyr.io/ws"
"nhooyr.io/ws/wsjson"
)
func ExampleEcho() {
func ExampleAccept_echo() {
fn := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
c, err := ws.Accept(w, r,
ws.AcceptSubprotocols("echo"),
......@@ -85,7 +86,7 @@ func ExampleAccept() {
type myJsonStruct struct {
MyField string `json:"my_field"`
}
err = wsjson.Write(c, myJsonStruct{
err = wsjson.Write(r.Context(), c, myJsonStruct{
MyField: "foo",
})
if err != nil {
......@@ -118,7 +119,7 @@ func ExampleDial() {
type myJsonStruct struct {
MyField string `json:"my_field"`
}
err = wsjson.Write(c, myJsonStruct{
err = wsjson.Write(ctx, c, myJsonStruct{
MyField: "foo",
})
if err != nil {
......
......@@ -6,8 +6,8 @@ require (
github.com/golang/protobuf v1.3.1
github.com/kr/pretty v0.1.0 // indirect
go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
golang.org/x/tools v0.0.0-20190315191501-e6df0c1bb376
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
golang.org/x/tools v0.0.0-20190329215204-73054e8977d1
mvdan.cc/sh v2.6.4+incompatible
)
......@@ -8,6 +8,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16 h1:3gGa1bM0nG7Ruhu5b7wKnoOOwAD/fJ8iyyAcpOzDG3A=
go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16/go.mod h1:iKV5yK9t+J5nG9O3uF6KYdPEz3dyfMyB15MN1rbQ8Qw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
......@@ -15,7 +17,8 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20190315191501-e6df0c1bb376 h1:GfNg/J4IAJguoN+DWPTZ54ElycoBxtQkpxhrbA5edVA=
golang.org/x/tools v0.0.0-20190315191501-e6df0c1bb376/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190329215204-73054e8977d1 h1:rLRH2E2wN5JjGJSVlBe1ioUkCKgb6eoL9X8bDmtEpsk=
golang.org/x/tools v0.0.0-20190329215204-73054e8977d1/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
mvdan.cc/sh v2.6.4+incompatible h1:eD6tDeh0pw+/TOTI1BBEryZ02rD2nMcFsgcvde7jffM=
mvdan.cc/sh v2.6.4+incompatible/go.mod h1:IeeQbZq+x2SUGBensq/jge5lLQbS3XT2ktyp3wrt4x8=
......@@ -4,6 +4,27 @@ package ws
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[StatusNormalClosure-1000]
_ = x[StatusGoingAway-1001]
_ = x[StatusProtocolError-1002]
_ = x[StatusUnsupportedData-1003]
_ = x[StatusNoStatusRcvd-1009]
_ = x[StatusAbnormalClosure-1010]
_ = x[StatusInvalidFramePayloadData-1011]
_ = x[StatusPolicyViolation-1012]
_ = x[StatusMessageTooBig-1013]
_ = x[StatusMandatoryExtension-1014]
_ = x[StatusInternalError-1015]
_ = x[StatusServiceRestart-1016]
_ = x[StatusTryAgainLater-1017]
_ = x[StatusBadGateway-1018]
_ = x[StatusTLSHandshake-1019]
}
const (
_StatusCode_name_0 = "StatusNormalClosureStatusGoingAwayStatusProtocolErrorStatusUnsupportedData"
_StatusCode_name_1 = "StatusNoStatusRcvdStatusAbnormalClosureStatusInvalidFramePayloadDataStatusPolicyViolationStatusMessageTooBigStatusMandatoryExtensionStatusInternalErrorStatusServiceRestartStatusTryAgainLaterStatusBadGatewayStatusTLSHandshake"
......
......@@ -5,6 +5,7 @@ package tools
// See https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md
import (
_ "go.coder.com/go-tools/cmd/goimports"
_ "golang.org/x/lint/golint"
_ "golang.org/x/tools/cmd/stringer"
_ "mvdan.cc/sh/cmd/shfmt"
)
......@@ -2,6 +2,7 @@ package ws
import (
"context"
"net"
)
const (
......@@ -18,6 +19,11 @@ func (c *Conn) Subprotocol() string {
panic("TODO")
}
// NetConn returns the net.Conn underlying the Conn.
func (c *Conn) NetConn() net.Conn {
panic("TODO")
}
// MessageWriter returns a writer bounded by the context that will write
// a WebSocket data frame of type dataType to the connection.
// Ensure you close the MessageWriter once you have written to entire message.
......
......@@ -19,10 +19,12 @@ type Header struct {
MaskKey [4]byte
}
// Bytes returns the bytes of the header.
func (h Header) Bytes() []byte {
panic("TODO")
}
func ReaderHeader(r io.Reader) []byte {
// ReadHeader reads a header from the reader.
func ReadHeader(r io.Reader) []byte {
panic("TODO")
}
......@@ -4,6 +4,7 @@ package wscore
//go:generate stringer -type=Opcode
type Opcode int
// Opcode constants.
const (
OpContinuation Opcode = iota
OpText
......
......@@ -4,6 +4,18 @@ package wscore
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[OpContinuation-0]
_ = x[OpText-1]
_ = x[OpBinary-2]
_ = x[OpClose-11]
_ = x[OpPing-12]
_ = x[OpPong-13]
}
const (
_Opcode_name_0 = "OpContinuationOpTextOpBinary"
_Opcode_name_1 = "OpCloseOpPingOpPong"
......
package wsjson
import (
"context"
"nhooyr.io/ws"
)
func Read(c *ws.Conn, v interface{}) error {
// Read reads a json message from c into v.
func Read(ctx context.Context, c *ws.Conn, v interface{}) error {
panic("TODO")
}
func Write(c *ws.Conn, v interface{}) error {
// Write writes the json message v into c.
func Write(ctx context.Context, c *ws.Conn, v interface{}) error {
panic("TODO")
}
package wspb
import (
"context"
"github.com/golang/protobuf/proto"
"nhooyr.io/ws"
)
func Read(c *ws.Conn, v proto.Message) error {
// Read reads a protobuf message from c into v.
func Read(ctx context.Context, c *ws.Conn, v proto.Message) error {
panic("TODO")
}
func Write(c *ws.Conn, v proto.Message) error {
// Write writes the protobuf message into c.
func Write(ctx context.Context, c *ws.Conn, v proto.Message) error {
panic("TODO")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment