Skip to content

Commit

Permalink
Format code using gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Apr 14, 2024
1 parent e27474c commit 0035c6f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/recv-dir/recv-dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func main() {
}

dir := filepath.Dir(p)
err = os.MkdirAll(dir, 0777)
err = os.MkdirAll(dir, 0o777)
if err != nil {
log.Fatalf("Failed to mkdirall %s: %s", dir, err)
}
Expand Down
2 changes: 0 additions & 2 deletions rendezvous/rendezvousservertest/rendezvousservertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ func (ts *TestServer) WebSocketURL() string {
u, err := url.Parse(ts.URL)
if err != nil {
panic(err)

}

u.Scheme = "ws"
u.Path = "/ws"

return u.String()

}

type mailbox struct {
Expand Down
2 changes: 1 addition & 1 deletion wormhole/file_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func newTransportCryptor(c net.Conn, transitKey []byte, readPurpose, writePurpos
writeKey: writeKey,
}
}

func (d *transportCryptor) Close() error {
return d.conn.Close()
}
Expand Down Expand Up @@ -293,7 +294,6 @@ func (t *fileTransport) connectToRelay(ctx context.Context, addr string, success
func (t *fileTransport) connectToSingleHost(ctx context.Context, addr string, successChan chan net.Conn, failChan chan string) {
var d net.Dialer
conn, err := d.DialContext(ctx, "tcp", addr)

if err != nil {
failChan <- addr
return
Expand Down
2 changes: 1 addition & 1 deletion wormhole/recv.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (c *Client) Receive(ctx context.Context, code string) (fr *IncomingMessage,
rc.Close(ctx, mood)
}()

var errStr = "transfer rejected"
errStr := "transfer rejected"
answer := &genericMessage{
Error: &errStr,
}
Expand Down
1 change: 0 additions & 1 deletion wormhole/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ func readSeekerSize(r io.ReadSeeker) (int64, error) {
}

return size, nil

}

type sendOptions struct {
Expand Down
3 changes: 1 addition & 2 deletions wormhole/wormhole.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ type genericMessage struct {
Error *string `json:"error,omitempty"`
}

type appVersionsMsg struct {
}
type appVersionsMsg struct{}

type answerMsg struct {
MessageAck string `json:"message_ack,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions wormhole/wormhole_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func TestWormholeBigFileTransportSendRecvViaRelayServer(t *testing.T) {

// skip th wrapper so we can provide our own offer
code, _, err := c0.sendFileDirectory(ctx, offer, io.NopCloser(r))
//c0.SendFile(ctx, "file.txt", buf)
// c0.SendFile(ctx, "file.txt", buf)
if err != nil {
t.Fatal(err)
}
Expand All @@ -345,7 +345,6 @@ func TestWormholeBigFileTransportSendRecvViaRelayServer(t *testing.T) {
if int64(receiver.TransferBytes) != fakeBigSize {
t.Fatalf("Mismatch in size between what we are trying to send and what is (our parsed) offer. Expected %v but got %v", fakeBigSize, receiver.TransferBytes)
}

}

func TestWormholeFileTransportRecvMidStreamCancel(t *testing.T) {
Expand Down Expand Up @@ -947,8 +946,10 @@ func (ts *testRelayServer) run() {
}
}

var headerPrefix = []byte("please relay ")
var headerSide = []byte(" for side ")
var (
headerPrefix = []byte("please relay ")
headerSide = []byte(" for side ")
)

func (ts *testRelayServer) handleConn(c net.Conn) {
// requests look like:
Expand Down Expand Up @@ -1036,7 +1037,6 @@ func (ts *testRelayServer) handleConn(c net.Conn) {
io.Copy(c, existing)
existing.Close()
c.Close()

}()

io.Copy(existing, c)
Expand Down

0 comments on commit 0035c6f

Please sign in to comment.