diff --git a/html/render.go b/html/render.go
index e8c12334..0157d89e 100644
--- a/html/render.go
+++ b/html/render.go
@@ -184,7 +184,7 @@ func render1(w writer, n *Node) error {
return err
}
- // Add initial newline where there is danger of a newline beging ignored.
+ // Add initial newline where there is danger of a newline being ignored.
if c := n.FirstChild; c != nil && c.Type == TextNode && strings.HasPrefix(c.Data, "\n") {
switch n.Data {
case "pre", "listing", "textarea":
diff --git a/html/token_test.go b/html/token_test.go
index 44773f17..e5ac6230 100644
--- a/html/token_test.go
+++ b/html/token_test.go
@@ -908,7 +908,7 @@ func benchmarkTokenizer(b *testing.B, level int) {
// not unescape < to <, or lower-case tag names and attribute keys.
z.Raw()
case lowLevel:
- // Caling z.Text, z.TagName and z.TagAttr returns []byte values
+ // Calling z.Text, z.TagName and z.TagAttr returns []byte values
// whose contents may change on the next call to z.Next.
switch tt {
case TextToken, CommentToken, DoctypeToken:
diff --git a/http2/clientconn_test.go b/http2/clientconn_test.go
index de2b9350..a9200a0f 100644
--- a/http2/clientconn_test.go
+++ b/http2/clientconn_test.go
@@ -332,7 +332,7 @@ func (tc *testClientConn) greet(settings ...Setting) {
// makeHeaderBlockFragment encodes headers in a form suitable for inclusion
// in a HEADERS or CONTINUATION frame.
//
-// It takes a list of alernating names and values.
+// It takes a list of alternating names and values.
func (tc *testClientConn) makeHeaderBlockFragment(s ...string) []byte {
if len(s)%2 != 0 {
tc.t.Fatalf("uneven list of header name/value pairs")
diff --git a/http2/frame.go b/http2/frame.go
index db3264da..d78218fd 100644
--- a/http2/frame.go
+++ b/http2/frame.go
@@ -347,7 +347,7 @@ func (fr *Framer) maxHeaderListSize() uint32 {
func (f *Framer) startWrite(ftype FrameType, flags Flags, streamID uint32) {
// Write the FrameHeader.
f.wbuf = append(f.wbuf[:0],
- 0, // 3 bytes of length, filled in in endWrite
+ 0, // 3 bytes of length, filled in endWrite
0,
0,
byte(ftype),
diff --git a/http2/frame_test.go b/http2/frame_test.go
index dfeff53a..6bf0026a 100644
--- a/http2/frame_test.go
+++ b/http2/frame_test.go
@@ -875,7 +875,7 @@ func TestReadFrameOrder(t *testing.T) {
continue
}
if !((f.errDetail == nil && tt.wantErr == "") || (fmt.Sprint(f.errDetail) == tt.wantErr)) {
- t.Errorf("%d. framer eror = %q; want %q\n%s", i, f.errDetail, tt.wantErr, log.Bytes())
+ t.Errorf("%d. framer error = %q; want %q\n%s", i, f.errDetail, tt.wantErr, log.Bytes())
}
if n < tt.atLeast {
t.Errorf("%d. framer only read %d frames; want at least %d\n%s", i, n, tt.atLeast, log.Bytes())
diff --git a/http2/netconn_test.go b/http2/netconn_test.go
index ffa87ec7..4d4124dc 100644
--- a/http2/netconn_test.go
+++ b/http2/netconn_test.go
@@ -100,7 +100,7 @@ func (c *synctestNetConn) LocalAddr() net.Addr {
return c.loc.addr
}
-// LocalAddr returns the (fake) remote network address.
+// RemoteAddr returns the (fake) remote network address.
func (c *synctestNetConn) RemoteAddr() net.Addr {
return c.rem.addr
}
@@ -301,7 +301,7 @@ func (h *synctestNetConnHalf) setWriteError(err error) {
}
}
-// deadlineContext converts a changable deadline (as in net.Conn.SetDeadline) into a Context.
+// deadlineContext converts a changeable deadline (as in net.Conn.SetDeadline) into a Context.
type deadlineContext struct {
mu sync.Mutex
ctx context.Context
diff --git a/http2/transport_test.go b/http2/transport_test.go
index 49aaf8c0..e918a4ed 100644
--- a/http2/transport_test.go
+++ b/http2/transport_test.go
@@ -4297,7 +4297,7 @@ func TestTransportBodyRewindRace(t *testing.T) {
for i := 0; i < clients; i++ {
req, err := http.NewRequest("POST", ts.URL, bytes.NewBufferString("abcdef"))
if err != nil {
- t.Fatalf("unexpect new request error: %v", err)
+ t.Fatalf("unexpected new request error: %v", err)
}
go func() {
@@ -4336,7 +4336,7 @@ func TestTransportServerResetStreamAtHeaders(t *testing.T) {
req, err := http.NewRequest("POST", ts.URL, errorReader{io.EOF})
if err != nil {
- t.Fatalf("unexpect new request error: %v", err)
+ t.Fatalf("unexpected new request error: %v", err)
}
req.ContentLength = 0 // so transport is tempted to sniff it
req.Header.Set("Expect", "100-continue")
diff --git a/http2/writesched_roundrobin.go b/http2/writesched_roundrobin.go
index 54fe8632..737cff9e 100644
--- a/http2/writesched_roundrobin.go
+++ b/http2/writesched_roundrobin.go
@@ -25,7 +25,7 @@ type roundRobinWriteScheduler struct {
}
// newRoundRobinWriteScheduler constructs a new write scheduler.
-// The round robin scheduler priorizes control frames
+// The round robin scheduler prioritizes control frames
// like SETTINGS and PING over DATA frames.
// When there are no control frames to send, it performs a round-robin
// selection from the ready streams.
diff --git a/internal/http3/qpack.go b/internal/http3/qpack.go
index 66f4e297..8fb4860b 100644
--- a/internal/http3/qpack.go
+++ b/internal/http3/qpack.go
@@ -224,7 +224,7 @@ func (st *stream) readPrefixedInt(prefixLen uint8) (firstByte byte, v int64, err
return firstByte, v, err
}
-// readPrefixedInt reads an RFC 7541 prefixed integer from st.
+// readPrefixedIntWithByte reads an RFC 7541 prefixed integer from st.
// The first byte has already been read from the stream.
func (st *stream) readPrefixedIntWithByte(firstByte byte, prefixLen uint8) (v int64, err error) {
prefixMask := (byte(1) << prefixLen) - 1
@@ -285,7 +285,7 @@ func (st *stream) readPrefixedString(prefixLen uint8) (firstByte byte, s string,
return firstByte, s, err
}
-// readPrefixedString reads an RFC 7541 string from st.
+// readPrefixedStringWithByte reads an RFC 7541 string from st.
// The first byte has already been read from the stream.
func (st *stream) readPrefixedStringWithByte(firstByte byte, prefixLen uint8) (s string, err error) {
size, err := st.readPrefixedIntWithByte(firstByte, prefixLen)
diff --git a/internal/http3/roundtrip_test.go b/internal/http3/roundtrip_test.go
index acd8613d..ba6a234a 100644
--- a/internal/http3/roundtrip_test.go
+++ b/internal/http3/roundtrip_test.go
@@ -125,7 +125,7 @@ func TestRoundTripResponseContentLength(t *testing.T) {
},
wantContentLength: -1,
}, {
- name: "unparseable",
+ name: "unparsable",
respHeader: http.Header{
":status": []string{"200"},
"content-length": []string{"1 1"},
@@ -185,7 +185,7 @@ func TestRoundTripMalformedResponses(t *testing.T) {
":status": []string{"200", "204"},
},
}, {
- name: "unparseable :status",
+ name: "unparsable :status",
respHeader: http.Header{
":status": []string{"frogpants"},
},
diff --git a/internal/http3/stream.go b/internal/http3/stream.go
index 0f975407..345e2f50 100644
--- a/internal/http3/stream.go
+++ b/internal/http3/stream.go
@@ -68,7 +68,7 @@ func newStream(qs *quic.Stream) *stream {
// https://www.rfc-editor.org/rfc/rfc9114.html#section-7.1
func (st *stream) readFrameHeader() (ftype frameType, err error) {
if st.lim >= 0 {
- // We shoudn't call readFrameHeader before ending the previous frame.
+ // We shouldn't call readFrameHeader before ending the previous frame.
return 0, errH3FrameError
}
ftype, err = readVarint[frameType](st)
diff --git a/internal/http3/stream_test.go b/internal/http3/stream_test.go
index 12b281c5..a034cc76 100644
--- a/internal/http3/stream_test.go
+++ b/internal/http3/stream_test.go
@@ -198,7 +198,7 @@ func TestStreamReadFrameHeaderPartial(t *testing.T) {
st1.stream.CloseWrite()
if _, err := st2.readFrameHeader(); err == nil {
- t.Fatalf("%v/%v bytes of frame available: st.readFrameHeader() succeded; want error", i, len(frame))
+ t.Fatalf("%v/%v bytes of frame available: st.readFrameHeader() succeeded; want error", i, len(frame))
}
}
}
diff --git a/internal/httpcommon/request.go b/internal/httpcommon/request.go
index 4b705531..1e10f89e 100644
--- a/internal/httpcommon/request.go
+++ b/internal/httpcommon/request.go
@@ -51,7 +51,7 @@ type EncodeHeadersParam struct {
DefaultUserAgent string
}
-// EncodeHeadersParam is the result of EncodeHeaders.
+// EncodeHeadersResult is the result of EncodeHeaders.
type EncodeHeadersResult struct {
HasBody bool
HasTrailers bool
@@ -399,7 +399,7 @@ type ServerRequestResult struct {
// If the request should be rejected, this is a short string suitable for passing
// to the http2 package's CountError function.
- // It might be a bit odd to return errors this way rather than returing an error,
+ // It might be a bit odd to return errors this way rather than returning an error,
// but this ensures we don't forget to include a CountError reason.
InvalidReason string
}
diff --git a/internal/quic/quicwire/wire.go b/internal/quic/quicwire/wire.go
index 0edf4222..06682520 100644
--- a/internal/quic/quicwire/wire.go
+++ b/internal/quic/quicwire/wire.go
@@ -46,7 +46,7 @@ func ConsumeVarint(b []byte) (v uint64, n int) {
return 0, -1
}
-// consumeVarintInt64 parses a variable-length integer as an int64.
+// ConsumeVarintInt64 parses a variable-length integer as an int64.
func ConsumeVarintInt64(b []byte) (v int64, n int) {
u, n := ConsumeVarint(b)
// QUIC varints are 62-bits large, so this conversion can never overflow.
diff --git a/internal/socks/socks.go b/internal/socks/socks.go
index 84fcc32b..8eedb84c 100644
--- a/internal/socks/socks.go
+++ b/internal/socks/socks.go
@@ -297,7 +297,7 @@ func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter,
b = append(b, up.Username...)
b = append(b, byte(len(up.Password)))
b = append(b, up.Password...)
- // TODO(mikio): handle IO deadlines and cancelation if
+ // TODO(mikio): handle IO deadlines and cancellation if
// necessary
if _, err := rw.Write(b); err != nil {
return err
diff --git a/nettest/conntest.go b/nettest/conntest.go
index 4297d408..8b98dfe2 100644
--- a/nettest/conntest.go
+++ b/nettest/conntest.go
@@ -142,7 +142,7 @@ func testPingPong(t *testing.T, c1, c2 net.Conn) {
}
// testRacyRead tests that it is safe to mutate the input Read buffer
-// immediately after cancelation has occurred.
+// immediately after cancellation has occurred.
func testRacyRead(t *testing.T, c1, c2 net.Conn) {
go chunkedCopy(c2, rand.New(rand.NewSource(0)))
@@ -170,7 +170,7 @@ func testRacyRead(t *testing.T, c1, c2 net.Conn) {
}
// testRacyWrite tests that it is safe to mutate the input Write buffer
-// immediately after cancelation has occurred.
+// immediately after cancellation has occurred.
func testRacyWrite(t *testing.T, c1, c2 net.Conn) {
go chunkedCopy(io.Discard, c2)
@@ -318,7 +318,7 @@ func testCloseTimeout(t *testing.T, c1, c2 net.Conn) {
defer wg.Wait()
wg.Add(3)
- // Test for cancelation upon connection closure.
+ // Test for cancellation upon connection closure.
c1.SetDeadline(neverTimeout)
go func() {
defer wg.Done()
diff --git a/quic/conn_close.go b/quic/conn_close.go
index 5001ab13..d22f3df5 100644
--- a/quic/conn_close.go
+++ b/quic/conn_close.go
@@ -109,7 +109,7 @@ func (c *Conn) setState(now time.Time, state connState) {
}
}
-// confirmHandshake is called when the TLS handshake completes.
+// handshakeDone is called when the TLS handshake completes.
func (c *Conn) handshakeDone() {
close(c.lifetime.readyc)
}
diff --git a/quic/conn_recv.go b/quic/conn_recv.go
index a24fc369..e4ef23b7 100644
--- a/quic/conn_recv.go
+++ b/quic/conn_recv.go
@@ -147,7 +147,7 @@ func (c *Conn) handle1RTT(now time.Time, dgram *datagram, buf []byte) int {
p, err := parse1RTTPacket(buf, &c.keysAppData, connIDLen, pnumMax)
if err != nil {
// A localTransportError terminates the connection.
- // Other errors indicate an unparseable packet, but otherwise may be ignored.
+ // Other errors indicate an unparsable packet, but otherwise may be ignored.
if _, ok := err.(localTransportError); ok {
c.abort(now, err)
}
diff --git a/quic/conn_test.go b/quic/conn_test.go
index 4b0511fc..24af38ac 100644
--- a/quic/conn_test.go
+++ b/quic/conn_test.go
@@ -150,7 +150,7 @@ type testConn struct {
// CRYPTO data produced by the conn's QUICConn is placed in
// cryptoDataOut.
//
- // The peerTLSConn is is a QUICConn representing the peer.
+ // The peerTLSConn is a QUICConn representing the peer.
// CRYPTO data produced by the conn is written to peerTLSConn,
// and data produced by peerTLSConn is placed in cryptoDataIn.
cryptoDataOut map[tls.QUICEncryptionLevel][]byte
@@ -1095,7 +1095,7 @@ func (tc *testConnHooks) handleTLSEvent(e tls.QUICEvent) {
case tls.QUICTransportParameters:
p, err := unmarshalTransportParams(e.Data)
if err != nil {
- tc.t.Logf("sent unparseable transport parameters %x %v", e.Data, err)
+ tc.t.Logf("sent unparsable transport parameters %x %v", e.Data, err)
} else {
tc.sentTransportParameters = &p
}
@@ -1171,7 +1171,7 @@ func testPeerStatelessResetToken(seq int64) statelessResetToken {
// canceledContext returns a canceled Context.
//
-// Functions which take a context preference progress over cancelation.
+// Functions which take a context preference progress over cancellation.
// For example, a read with a canceled context will return data if any is available.
// Tests use canceled contexts to perform non-blocking operations.
func canceledContext() context.Context {
diff --git a/quic/crypto_stream.go b/quic/crypto_stream.go
index ce73cb54..a5b98182 100644
--- a/quic/crypto_stream.go
+++ b/quic/crypto_stream.go
@@ -142,7 +142,7 @@ func (s *cryptoStream) sendData(off int64, b []byte) {
func (s *cryptoStream) discardKeys() error {
if s.in.end-s.in.start != 0 {
// The peer sent some unprocessed CRYPTO data that we're about to discard.
- // Close the connetion with a TLS unexpected_message alert.
+ // Close the connection with a TLS unexpected_message alert.
// https://www.rfc-editor.org/rfc/rfc5246#section-7.2.2
const unexpectedMessage = 10
return localTransportError{
diff --git a/quic/doc.go b/quic/doc.go
index 2fd10f08..37b19eb1 100644
--- a/quic/doc.go
+++ b/quic/doc.go
@@ -21,7 +21,7 @@
//
// A [Stream] is a QUIC stream, an ordered, reliable byte stream.
//
-// # Cancelation
+// # Cancellation
//
// All blocking operations may be canceled using a context.Context.
// When performing an operation with a canceled context, the operation
diff --git a/quic/loss.go b/quic/loss.go
index ffbf69dd..95feaba2 100644
--- a/quic/loss.go
+++ b/quic/loss.go
@@ -178,7 +178,7 @@ func (c *lossState) nextNumber(space numberSpace) packetNumber {
return c.spaces[space].nextNum
}
-// skipPacketNumber skips a packet number as a defense against optimistic ACK attacks.
+// skipNumber skips a packet number as a defense against optimistic ACK attacks.
func (c *lossState) skipNumber(now time.Time, space numberSpace) {
sent := newSentPacket()
sent.num = c.spaces[space].nextNum
diff --git a/quic/loss_test.go b/quic/loss_test.go
index 545f2c41..6d07d137 100644
--- a/quic/loss_test.go
+++ b/quic/loss_test.go
@@ -675,7 +675,7 @@ func TestLossPTONotSetWhenLossTimerSet(t *testing.T) {
t.Logf("# PTO = smoothed_rtt + max(4*rttvar, 1ms)")
test.wantTimeout(999 * time.Millisecond)
- t.Logf("# ack of packet 1 starts loss timer for 0, PTO overidden")
+ t.Logf("# ack of packet 1 starts loss timer for 0, PTO overridden")
test.advance(333 * time.Millisecond)
test.ack(initialSpace, 0*time.Millisecond, i64range[packetNumber]{1, 2})
test.wantAck(initialSpace, 1)
diff --git a/quic/queue_test.go b/quic/queue_test.go
index eee34e5b..b5835214 100644
--- a/quic/queue_test.go
+++ b/quic/queue_test.go
@@ -17,7 +17,7 @@ func TestQueue(t *testing.T) {
q := newQueue[int]()
if got, err := q.get(nonblocking, nil); err != context.Canceled {
- t.Fatalf("q.get() = %v, %v, want nil, contex.Canceled", got, err)
+ t.Fatalf("q.get() = %v, %v, want nil, context.Canceled", got, err)
}
if !q.put(1) {
@@ -33,7 +33,7 @@ func TestQueue(t *testing.T) {
t.Fatalf("q.get() = %v, %v, want 2, nil", got, err)
}
if got, err := q.get(nonblocking, nil); err != context.Canceled {
- t.Fatalf("q.get() = %v, %v, want nil, contex.Canceled", got, err)
+ t.Fatalf("q.get() = %v, %v, want nil, context.Canceled", got, err)
}
go func() {
diff --git a/quic/skip.go b/quic/skip.go
index f5ba764f..f0d0234e 100644
--- a/quic/skip.go
+++ b/quic/skip.go
@@ -32,7 +32,7 @@ func (ss *skipState) init(c *Conn) {
ss.updateNumberSkip(c)
}
-// shouldSkipAfter returns whether we should skip the given packet number.
+// shouldSkip returns whether we should skip the given packet number.
func (ss *skipState) shouldSkip(num packetNumber) bool {
return ss.skip == num
}
diff --git a/quic/tls.go b/quic/tls.go
index 171d5a31..9f6e0bc2 100644
--- a/quic/tls.go
+++ b/quic/tls.go
@@ -33,7 +33,7 @@ func (c *Conn) startTLS(now time.Time, initialConnID []byte, peerHostname string
c.tls = tls.QUICServer(qconfig)
}
c.tls.SetTransportParameters(marshalTransportParameters(params))
- // TODO: We don't need or want a context for cancelation here,
+ // TODO: We don't need or want a context for cancellation here,
// but users can use a context to plumb values through to hooks defined
// in the tls.Config. Pass through a context.
if err := c.tls.Start(context.TODO()); err != nil {
diff --git a/quic/tlsconfig_test.go b/quic/tlsconfig_test.go
index b1305ec0..8a07b0b1 100644
--- a/quic/tlsconfig_test.go
+++ b/quic/tlsconfig_test.go
@@ -21,7 +21,7 @@ func newTestTLSConfig(side connSide) *tls.Config {
MinVersion: tls.VersionTLS13,
// Default key exchange mechanisms as of Go 1.23 minus X25519Kyber768Draft00,
// which bloats the client hello enough to spill into a second datagram.
- // Tests were written with the assuption each flight in the handshake
+ // Tests were written with the assumption each flight in the handshake
// fits in one datagram, and it's simpler to keep that property.
CurvePreferences: []tls.CurveID{
tls.X25519, tls.CurveP256, tls.CurveP384, tls.CurveP521,