Skip to content

Commit

Permalink
chore: Add missing dots at the end of comments (#1677)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Dec 13, 2023
1 parent 12949de commit 9d6b470
Show file tree
Hide file tree
Showing 18 changed files with 139 additions and 126 deletions.
22 changes: 14 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ linters:
- gocognit
- goconst
- gocyclo
- godot
- goerr113
- gomnd
- gosec
Expand All @@ -35,7 +34,6 @@ linters:
- nonamedreturns
- paralleltest
- perfsprint
- stylecheck
- testableexamples
- testpackage
- thelper
Expand All @@ -59,20 +57,28 @@ linters:
- varcheck

linters-settings:
# Show all issues from a linter.
max-issues-per-linter: 0

# Show all issues with the same text.
max-same-issues: 0

revive:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
rules:
- name: use-any
lll:
line-length: 130
stylecheck:
checks: [
"all",
"-ST1000", # at least one file in a package should have a package comment
]

issues:
# Show all issues from a linter.
max-issues-per-linter: 0

# Show all issues with the same text.
max-same-issues: 0

include:
- EXC0011 # include issues about comments from `stylecheck`

exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
Expand Down
4 changes: 2 additions & 2 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (a *Args) QueryString() []byte {

// Sort sorts Args by key and then value using 'f' as comparison function.
//
// For example args.Sort(bytes.Compare)
// For example args.Sort(bytes.Compare).
func (a *Args) Sort(f func(x, y []byte) int) {
sort.SliceStable(a.args, func(i, j int) bool {
n := f(a.args[i].key, a.args[j].key)
Expand Down Expand Up @@ -229,7 +229,7 @@ func (a *Args) SetBytesKV(key, value []byte) {

// SetNoValue sets only 'key' as argument without the '='.
//
// Only key in argument, like key1&key2
// Only key in argument, like key1&key2.
func (a *Args) SetNoValue(key string) {
a.args = setArg(a.args, key, "", argsNoValue)
}
Expand Down
32 changes: 16 additions & 16 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ type Client struct {
// By default connection duration is unlimited.
MaxConnDuration time.Duration

// Maximum number of attempts for idempotent calls
// Maximum number of attempts for idempotent calls.
//
// DefaultMaxIdemponentCallAttempts is used if not set.
MaxIdemponentCallAttempts int
Expand Down Expand Up @@ -278,7 +278,7 @@ type Client struct {
// * cONTENT-lenGTH -> Content-Length
DisableHeaderNamesNormalizing bool

// Path values are sent as-is without normalization
// Path values are sent as-is without normalization.
//
// Disabled path normalization may be useful for proxying incoming requests
// to servers that are expecting paths to be forwarded as-is.
Expand All @@ -289,18 +289,18 @@ type Client struct {

// Maximum duration for waiting for a free connection.
//
// By default will not waiting, return ErrNoFreeConns immediately
// By default will not waiting, return ErrNoFreeConns immediately.
MaxConnWaitTimeout time.Duration

// RetryIf controls whether a retry should be attempted after an error.
//
// By default will use isIdempotent function
// By default will use isIdempotent function.
RetryIf RetryIfFunc

// Connection pool strategy. Can be either LIFO or FIFO (default).
ConnPoolStrategy ConnPoolStrategyType

// StreamResponseBody enables response body streaming
// StreamResponseBody enables response body streaming.
StreamResponseBody bool

// ConfigureClient configures the fasthttp.HostClient.
Expand Down Expand Up @@ -648,7 +648,7 @@ type DialFunc func(addr string) (net.Conn, error)
// - foobar.com:8080
type DialFuncWithTimeout func(addr string, timeout time.Duration) (net.Conn, error)

// RetryIfFunc signature of retry if function
// RetryIfFunc signature of retry if function.
//
// Request argument passed to RetryIfFunc, if there are any request errors.
type RetryIfFunc func(request *Request) bool
Expand All @@ -658,7 +658,7 @@ type RoundTripper interface {
RoundTrip(hc *HostClient, req *Request, resp *Response) (retry bool, err error)
}

// ConnPoolStrategyType define strategy of connection pool enqueue/dequeue
// ConnPoolStrategyType define strategy of connection pool enqueue/dequeue.
type ConnPoolStrategyType int

const (
Expand Down Expand Up @@ -746,7 +746,7 @@ type HostClient struct {
// after DefaultMaxIdleConnDuration.
MaxIdleConnDuration time.Duration

// Maximum number of attempts for idempotent calls
// Maximum number of attempts for idempotent calls.
//
// DefaultMaxIdemponentCallAttempts is used if not set.
MaxIdemponentCallAttempts int
Expand Down Expand Up @@ -798,7 +798,7 @@ type HostClient struct {
// * cONTENT-lenGTH -> Content-Length
DisableHeaderNamesNormalizing bool

// Path values are sent as-is without normalization
// Path values are sent as-is without normalization.
//
// Disabled path normalization may be useful for proxying incoming requests
// to servers that are expecting paths to be forwarded as-is.
Expand All @@ -807,7 +807,7 @@ type HostClient struct {
// extra slashes are removed, special characters are encoded.
DisablePathNormalizing bool

// Will not log potentially sensitive content in error logs
// Will not log potentially sensitive content in error logs.
//
// This option is useful for servers that handle sensitive data
// in the request/response.
Expand All @@ -831,7 +831,7 @@ type HostClient struct {
// Connection pool strategy. Can be either LIFO or FIFO (default).
ConnPoolStrategy ConnPoolStrategyType

// StreamResponseBody enables response body streaming
// StreamResponseBody enables response body streaming.
StreamResponseBody bool

lastUseTime uint32
Expand Down Expand Up @@ -872,7 +872,7 @@ type clientConn struct {

var startTimeUnix = time.Now().Unix()

// LastUseTime returns time the client was last used
// LastUseTime returns time the client was last used.
func (c *HostClient) LastUseTime() time.Time {
n := atomic.LoadUint32(&c.lastUseTime)
return time.Unix(startTimeUnix+int64(n), 0)
Expand Down Expand Up @@ -1694,7 +1694,7 @@ func (c *HostClient) decConnsCount() {
}
}

// ConnsCount returns connection count of HostClient
// ConnsCount returns connection count of HostClient.
func (c *HostClient) ConnsCount() int {
c.connsLock.Lock()
defer c.connsLock.Unlock()
Expand Down Expand Up @@ -1952,7 +1952,7 @@ func dialAddr(
return nil, err
}
if conn == nil {
return nil, errors.New("dialling unsuccessful. Please report this bug!")
return nil, errors.New("dialling unsuccessful. Please report this bug")
}

// We assume that any conn that has the Handshake() method is a TLS conn already.
Expand Down Expand Up @@ -2026,7 +2026,7 @@ func AddMissingPort(addr string, isTLS bool) string {
// These three options are racing against each other and use
// wantConn to coordinate and agree about the winning outcome.
//
// inspired by net/http/transport.go
// Inspired by net/http/transport.go.
type wantConn struct {
ready chan struct{}
mu sync.Mutex // protects conn, err, close(ready)
Expand Down Expand Up @@ -2081,7 +2081,7 @@ func (w *wantConn) cancel(c *HostClient, err error) {

// A wantConnQueue is a queue of wantConns.
//
// inspired by net/http/transport.go
// Inspired by net/http/transport.go.
type wantConnQueue struct {
// This is a queue, not a dequeue.
// It is split into two stages - head[headPos:] and tail.
Expand Down
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2273,11 +2273,11 @@ func (w *writeErrorConn) RemoteAddr() net.Addr {
return nil
}

func (r *writeErrorConn) SetReadDeadline(_ time.Time) error {
func (w *writeErrorConn) SetReadDeadline(_ time.Time) error {
return nil
}

func (r *writeErrorConn) SetWriteDeadline(_ time.Time) error {
func (w *writeErrorConn) SetWriteDeadline(_ time.Time) error {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions client_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
)

// See issue #1232
// See issue #1232.
func TestRstConnResponseWhileSending(t *testing.T) {
const expectedStatus = http.StatusTeapot
const payload = "payload"
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestRstConnResponseWhileSending(t *testing.T) {
}
}

// See issue #1232
// See issue #1232.
func TestRstConnClosedWithoutResponse(t *testing.T) {
const payload = "payload"

Expand Down
20 changes: 10 additions & 10 deletions cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ var (
type CookieSameSite int

const (
// CookieSameSiteDisabled removes the SameSite flag
// CookieSameSiteDisabled removes the SameSite flag.
CookieSameSiteDisabled CookieSameSite = iota
// CookieSameSiteDefaultMode sets the SameSite flag
// CookieSameSiteDefaultMode sets the SameSite flag.
CookieSameSiteDefaultMode
// CookieSameSiteLaxMode sets the SameSite flag with the "Lax" parameter
// CookieSameSiteLaxMode sets the SameSite flag with the "Lax" parameter.
CookieSameSiteLaxMode
// CookieSameSiteStrictMode sets the SameSite flag with the "Strict" parameter
// CookieSameSiteStrictMode sets the SameSite flag with the "Strict" parameter.
CookieSameSiteStrictMode
// CookieSameSiteNoneMode sets the SameSite flag with the "None" parameter
// see https://tools.ietf.org/html/draft-west-cookie-incrementalism-00
// CookieSameSiteNoneMode sets the SameSite flag with the "None" parameter.
// See https://tools.ietf.org/html/draft-west-cookie-incrementalism-00
CookieSameSiteNoneMode
)

Expand Down Expand Up @@ -122,7 +122,7 @@ func (c *Cookie) SameSite() CookieSameSite {
}

// SetSameSite sets the cookie's SameSite flag to the given value.
// set value CookieSameSiteNoneMode will set Secure to true also to avoid browser rejection
// Set value CookieSameSiteNoneMode will set Secure to true also to avoid browser rejection.
func (c *Cookie) SetSameSite(mode CookieSameSite) {
c.sameSite = mode
if mode == CookieSameSiteNoneMode {
Expand Down Expand Up @@ -172,16 +172,16 @@ func (c *Cookie) MaxAge() int {
}

// SetMaxAge sets cookie expiration time based on seconds. This takes precedence
// over any absolute expiry set on the cookie
// over any absolute expiry set on the cookie.
//
// Set max age to 0 to unset
// Set max age to 0 to unset.
func (c *Cookie) SetMaxAge(seconds int) {
c.maxAge = seconds
}

// Expire returns cookie expiration time.
//
// CookieExpireUnlimited is returned if cookie doesn't expire
// CookieExpireUnlimited is returned if cookie doesn't expire.
func (c *Cookie) Expire() time.Time {
expire := c.expire
if expire.IsZero() {
Expand Down
4 changes: 2 additions & 2 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ func (ff *fsFile) smallFileReader() (io.Reader, error) {
return r, nil
}

// files bigger than this size are sent with sendfile
// Files bigger than this size are sent with sendfile.
const maxSmallFileSize = 2 * 4096

func (ff *fsFile) isBig() bool {
Expand Down Expand Up @@ -1436,7 +1436,7 @@ func (h *fsHandler) compressFileNolock(
return h.newCompressedFSFile(compressedFilePath, fileEncoding)
}

// newCompressedFSFileCache use memory cache compressed files
// newCompressedFSFileCache use memory cache compressed files.
func (h *fsHandler) newCompressedFSFileCache(f fs.File, fileInfo fs.FileInfo, filePath, fileEncoding string) (*fsFile, error) {
var (
w = &bytebufferpool.ByteBuffer{}
Expand Down
2 changes: 0 additions & 2 deletions fs_fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,6 @@ func TestFSServeFileDirectoryRedirect(t *testing.T) {
}
}

// //*
// *//
var dirTestFilesystem = os.DirFS(".")

func TestDirFSServeFileHead(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions fs_handler_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/valyala/fasthttp"
)

// Setup file handlers (aka 'file server config')
// Setup file handlers (aka 'file server config').
var (
// Handler for serving images from /img/ path,
// i.e. /img/foo/bar.jpg will be served from
Expand All @@ -27,7 +27,7 @@ var (
filesHandler = fasthttp.FSHandler("/var/www/files", 0)
)

// Main request handler
// Main request handler.
func requestHandler(ctx *fasthttp.RequestCtx) {
path := ctx.Path()
switch {
Expand Down
12 changes: 6 additions & 6 deletions header.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func (h *ResponseHeader) SetContentEncodingBytes(contentEncoding []byte) {
h.contentEncoding = append(h.contentEncoding[:0], contentEncoding...)
}

// addVaryBytes add value to the 'Vary' header if it's not included
// addVaryBytes add value to the 'Vary' header if it's not included.
func (h *ResponseHeader) addVaryBytes(value []byte) {
v := h.peek(strVary)
if len(v) == 0 {
Expand Down Expand Up @@ -948,7 +948,7 @@ func (h *RequestHeader) DisableNormalizing() {
// - conteNT-tYPE -> Content-Type
// - foo-bar-baz -> Foo-Bar-Baz
//
// This is enabled by default unless disabled using DisableNormalizing()
// This is enabled by default unless disabled using DisableNormalizing().
func (h *RequestHeader) EnableNormalizing() {
h.disableNormalizing = false
}
Expand Down Expand Up @@ -980,7 +980,7 @@ func (h *ResponseHeader) DisableNormalizing() {
// - conteNT-tYPE -> Content-Type
// - foo-bar-baz -> Foo-Bar-Baz
//
// This is enabled by default unless disabled using DisableNormalizing()
// This is enabled by default unless disabled using DisableNormalizing().
func (h *ResponseHeader) EnableNormalizing() {
h.disableNormalizing = false
}
Expand Down Expand Up @@ -1350,7 +1350,7 @@ func (h *ResponseHeader) setSpecialHeader(key, value []byte) bool {
return false
}

// setNonSpecial directly put into map i.e. not a basic header
// setNonSpecial directly put into map i.e. not a basic header.
func (h *ResponseHeader) setNonSpecial(key []byte, value []byte) {
h.h = setArgBytes(h.h, key, value, argsHasValue)
}
Expand Down Expand Up @@ -1409,7 +1409,7 @@ func (h *RequestHeader) setSpecialHeader(key, value []byte) bool {
return false
}

// setNonSpecial directly put into map i.e. not a basic header
// setNonSpecial directly put into map i.e. not a basic header.
func (h *RequestHeader) setNonSpecial(key []byte, value []byte) {
h.h = setArgBytes(h.h, key, value, argsHasValue)
}
Expand Down Expand Up @@ -3332,7 +3332,7 @@ func normalizeHeaderKey(b []byte, disableNormalizing bool) {
}
}

// removeNewLines will replace `\r` and `\n` with an empty space
// removeNewLines will replace `\r` and `\n` with an empty space.
func removeNewLines(raw []byte) []byte {
// check if a `\r` is present and save the position.
// if no `\r` is found, check if a `\n` is present.
Expand Down
Loading

0 comments on commit 9d6b470

Please sign in to comment.