add codespell action (#18818)

Original work here, #18474,  refixed and updated.
This commit is contained in:
Harshavardhana
2024-01-17 23:03:17 -08:00
committed by GitHub
parent 21d60eab7c
commit dd2542e96c
125 changed files with 230 additions and 202 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ func Parse(amzDateStr string) (time.Time, error) {
}
var httpTimeFormats = []string{
// Do not chagne this order, http time format dates
// Do not change this order, http time format dates
// are usually in http.TimeFormat however there are
// situations where for example aws-sdk-java doesn't
// send the correct format.
+1 -1
View File
@@ -89,7 +89,7 @@ func (a And) ContainsDuplicateTag() bool {
}
// BySize returns true when sz satisfies a
// ObjectSizeLessThan/ObjectSizeGreaterthan or a logial AND of these predicates
// ObjectSizeLessThan/ObjectSizeGreaterthan or a logical AND of these predicates
// Note: And combines size and other predicates like Tags, Prefix, etc. This
// method applies exclusively to size predicates only.
func (a And) BySize(sz int64) bool {
+1 -1
View File
@@ -249,7 +249,7 @@ func (f Filter) TestTags(userTags string) bool {
return false
}
// BySize returns true if sz satisifies one of ObjectSizeGreaterThan,
// BySize returns true if sz satisfies one of ObjectSizeGreaterThan,
// ObjectSizeLessThan predicates or a combination of them via And.
func (f Filter) BySize(sz int64) bool {
if f.ObjectSizeGreaterThan > 0 &&
+1 -1
View File
@@ -135,7 +135,7 @@ func (c Config) Get(r *CondCheck) (*ObjectInfo, error) {
return nil, err
}
// We do not want Get's to take so much time, anything
// We do not want Gets to take so much time, anything
// beyond 250ms we should cut it, remote cache is too
// busy already.
ctx, cancel := context.WithTimeout(context.Background(), 250*time.Millisecond)
+1 -1
View File
@@ -604,7 +604,7 @@ func LookupSite(siteKV KVS, regionKV KVS) (s Site, err error) {
}
// CheckValidKeys - checks if inputs KVS has the necessary keys,
// returns error if it find extra or superflous keys.
// returns error if it find extra or superfluous keys.
func CheckValidKeys(subSys string, kv KVS, validKVS KVS, deprecatedKeys ...string) error {
nkv := KVS{}
for _, kv := range kv {
+1 -1
View File
@@ -258,7 +258,7 @@ func TestExpCorrect(t *testing.T) {
if err := updateClaimsExpiry("3600", claimsMap.MapClaims); err != nil {
t.Error(err)
}
// Build simple toke with updated expiration claim
// Build simple token with updated expiration claim
token := jwtgo.NewWithClaims(jwtgo.SigningMethodHS256, claimsMap)
tokenString, err := token.SignedString(signKey)
if err != nil {
@@ -53,7 +53,7 @@ var (
ErrAccessTokenExpired = errors.New("access_token expired or unauthorized")
)
// Provider implements indentity provider specific admin operations, such as
// Provider implements identity provider specific admin operations, such as
// looking up users, fetching additional attributes etc.
type Provider interface {
LoginWithUser(username, password string) error
@@ -91,7 +91,7 @@ func (p *providerCfg) initializeProvider(cfgGet func(string) string, transport h
)
return err
default:
return fmt.Errorf("Unsupport vendor %s", keyCloakVendor)
return fmt.Errorf("Unsupported vendor %s", keyCloakVendor)
}
}
+1 -1
View File
@@ -197,7 +197,7 @@ func (h *metrics) accumRequestRTT(reqStartTime time.Time, rttMs float64, isSucce
}
}
// Round the reqest time *down* to whole minute.
// Round the request time *down* to whole minute.
reqTimeMinute := reqStartTime.Truncate(time.Minute)
if reqTimeMinute.After(h.currentMinute.statsTime) {
// Drop the last full minute now, since we got a request for a time we
+1 -1
View File
@@ -50,7 +50,7 @@ func (set TargetIDSet) Union(sset TargetIDSet) TargetIDSet {
return nset
}
// Difference - returns diffrence with given set as new set.
// Difference - returns difference with given set as new set.
func (set TargetIDSet) Difference(sset TargetIDSet) TargetIDSet {
nset := NewTargetIDSet()
for k := range set {
+1 -1
View File
@@ -143,7 +143,7 @@ var (
},
config.HelpKV{
Key: target.AmqpPublisherConfirms,
Description: "enable consumer acknowlegement and publisher confirms, use this along with queue_dir for guaranteed delivery of all events",
Description: "enable consumer acknowledgement and publisher confirms, use this along with queue_dir for guaranteed delivery of all events",
Optional: true,
Type: "on|off",
},
+1 -1
View File
@@ -74,7 +74,7 @@ func GenerateIV(random io.Reader) (iv [32]byte) {
// SealedKey represents a sealed object key. It can be stored
// at an untrusted location.
type SealedKey struct {
Key [64]byte // The encrypted and authenticted object-key.
Key [64]byte // The encrypted and authenticated object-key.
IV [32]byte // The random IV used to encrypt the object-key.
Algorithm string // The sealing algorithm used to encrypt the object key.
}
+1 -1
View File
@@ -156,7 +156,7 @@ func IsEncrypted(metadata map[string]string) (Type, bool) {
}
// CreateMultipartMetadata adds the multipart flag entry to metadata
// and returns modifed metadata. It allocates a new metadata map if
// and returns modified metadata. It allocates a new metadata map if
// metadata is nil.
func CreateMultipartMetadata(metadata map[string]string) map[string]string {
if metadata == nil {
+1 -1
View File
@@ -58,7 +58,7 @@ func (ssec) IsRequested(h http.Header) bool {
}
// IsEncrypted returns true if the metadata contains an SSE-C
// entry inidicating that the object has been encrypted using
// entry indicating that the object has been encrypted using
// SSE-C.
func (ssec) IsEncrypted(metadata map[string]string) bool {
if _, ok := metadata[MetaSealedKeySSEC]; ok {
+2 -2
View File
@@ -137,7 +137,7 @@ func (ssekms) CreateMetadata(metadata map[string]string, keyID string, kmsKey []
logger.CriticalIf(context.Background(), Errorf("The seal algorithm '%s' is invalid for SSE-S3", sealedKey.Algorithm))
}
// There are two possibilites:
// There are two possibilities:
// - We use a KMS -> There must be non-empty key ID and a KMS data key.
// - We use a K/V -> There must be no key ID and no KMS data key.
// Otherwise, the caller has passed an invalid argument combination.
@@ -187,7 +187,7 @@ func (ssekms) ParseMetadata(metadata map[string]string) (keyID string, kmsKey []
return keyID, kmsKey, sealedKey, ctx, Errorf("The object metadata is missing the internal sealed key for SSE-S3")
}
// There are two possibilites:
// There are two possibilities:
// - We use a KMS -> There must be a key ID and a KMS data key.
// - We use a K/V -> There must be no key ID and no KMS data key.
// Otherwise, the metadata is corrupted.
+2 -2
View File
@@ -157,7 +157,7 @@ func (sses3) CreateMetadata(metadata map[string]string, keyID string, kmsKey []b
logger.CriticalIf(context.Background(), Errorf("The seal algorithm '%s' is invalid for SSE-S3", sealedKey.Algorithm))
}
// There are two possibilites:
// There are two possibilities:
// - We use a KMS -> There must be non-empty key ID and a KMS data key.
// - We use a K/V -> There must be no key ID and no KMS data key.
// Otherwise, the caller has passed an invalid argument combination.
@@ -203,7 +203,7 @@ func (sses3) ParseMetadata(metadata map[string]string) (keyID string, kmsKey []b
return keyID, kmsKey, sealedKey, Errorf("The object metadata is missing the internal sealed key for SSE-S3")
}
// There are two possibilites:
// There are two possibilities:
// - We use a KMS -> There must be a key ID and a KMS data key.
// - We use a K/V -> There must be no key ID and no KMS data key.
// Otherwise, the metadata is corrupted.
+1 -1
View File
@@ -557,7 +557,7 @@ func checkFailedUnlocks(locks []string, tolerance int) bool {
// caller know that lock is not successfully released
// yet.
if len(locks)-tolerance == tolerance {
// Incase of split brain scenarios where
// In case of split brain scenarios where
// tolerance is exactly half of the len(*locks)
// then we need to make sure we have unlocked
// upto tolerance+1 - especially for RUnlock
+1 -1
View File
@@ -102,7 +102,7 @@
// (case-sensitive) and will fail otherwise.
// Further, some clients require that the ETag value is a double-quoted
// string. Therefore, this package provides dedicated functions for
// adding and extracing the ETag to/from HTTP headers.
// adding and extracting the ETag to/from HTTP headers.
package etag
import (
+1 -1
View File
@@ -52,7 +52,7 @@ func (r wrapReader) ETag() ETag {
// returns ETag of the content. Otherwise, it returns
// nil as ETag.
//
// Wrap provides an adapter for io.Reader implemetations
// Wrap provides an adapter for io.Reader implementations
// that don't implement the Tagger interface.
// It is mainly used to provide a high-level io.Reader
// access to the ETag computed by a low-level io.Reader:
+1 -1
View File
@@ -99,7 +99,7 @@ func (rules Rules) Union(rules2 Rules) Rules {
return nrules
}
// Difference - returns diffrence with given rules as new rules.
// Difference - returns difference with given rules as new rules.
func (rules Rules) Difference(rules2 Rules) Rules {
nrules := make(Rules)
+1 -1
View File
@@ -71,7 +71,7 @@ const (
ESSUnknown ESSupportStatus = "ESSUnknown"
// ESSDeprecated -> support will be removed in future
ESSDeprecated ESSupportStatus = "ESSDeprecated"
// ESSUnsupported -> we wont work with this ES server
// ESSUnsupported -> we won't work with this ES server
ESSUnsupported ESSupportStatus = "ESSUnsupported"
// ESSSupported -> all good!
ESSSupported ESSupportStatus = "ESSSupported"
+2 -2
View File
@@ -336,7 +336,7 @@ func (target *KafkaTarget) Close() error {
return nil
}
// Check if atleast one broker in cluster is active
// Check if at least one broker in cluster is active
func (k KafkaArgs) pingBrokers() (err error) {
d := net.Dialer{Timeout: 1 * time.Second}
@@ -479,6 +479,6 @@ func NewKafkaTarget(id string, args KafkaArgs, loggerOnce logger.LogOnce) (*Kafk
}
func isKafkaConnErr(err error) bool {
// Sarama opens the ciruit breaker after 3 consecutive connection failures.
// Sarama opens the circuit breaker after 3 consecutive connection failures.
return err == sarama.ErrLeaderNotAvailable || err.Error() == "circuit breaker is open"
}
+1 -1
View File
@@ -50,7 +50,7 @@ func (set TargetIDSet) Union(sset TargetIDSet) TargetIDSet {
return nset
}
// Difference - returns diffrence with given set as new set.
// Difference - returns difference with given set as new set.
func (set TargetIDSet) Difference(sset TargetIDSet) TargetIDSet {
nset := NewTargetIDSet()
for k := range set {
+1 -1
View File
@@ -119,7 +119,7 @@ In the examples we use a `MSS` type, which is a `map[string]string` that is `msg
```
The wrapper will handle all serialization and de-seralization of the request and response,
and furthermore provides re-use of the structs used for the request and response.
and furthermore provides reuse of the structs used for the request and response.
Note that Responses sent for serialization are automatically reused for similar requests.
If the response contains shared data it will cause issues, since each unique response is reused.
+1 -1
View File
@@ -72,7 +72,7 @@ type ManagerOptions struct {
Hosts []string // All hosts, including local in the grid.
AddAuth AuthFn // Add authentication to the given audience.
AuthRequest func(r *http.Request) error // Validate incoming requests.
TLSConfig *tls.Config // TLS to apply to the connnections.
TLSConfig *tls.Config // TLS to apply to the connections.
Incoming func(n int64) // Record incoming bytes.
Outgoing func(n int64) // Record outgoing bytes.
BlockConnect chan struct{} // If set, incoming and outgoing connections will be blocked until closed.
+1 -1
View File
@@ -228,7 +228,7 @@ func (m *muxServer) checkSeq(seq uint32) (ok bool) {
func (m *muxServer) message(msg message) {
if debugPrint {
fmt.Printf("muxServer: recevied message %d, length %d\n", msg.Seq, len(msg.Payload))
fmt.Printf("muxServer: received message %d, length %d\n", msg.Seq, len(msg.Payload))
}
m.recvMu.Lock()
defer m.recvMu.Unlock()
+1 -1
View File
@@ -166,7 +166,7 @@ func (c ChecksumType) Hasher() hash.Hash {
return nil
}
// Trailing return whether the checksum is traling.
// Trailing return whether the checksum is trailing.
func (c ChecksumType) Trailing() bool {
return c.Is(ChecksumTrailing)
}
+2 -2
View File
@@ -27,11 +27,11 @@ import (
// convenient wrapper to drain any remaining data on response body.
//
// Subsequently this allows golang http RoundTripper
// to re-use the same connection for future requests.
// to reuse the same connection for future requests.
func DrainBody(respBody io.ReadCloser) {
// Callers should close resp.Body when done reading from it.
// If resp.Body is not closed, the Client's underlying RoundTripper
// (typically Transport) may not be able to re-use a persistent TCP
// (typically Transport) may not be able to reuse a persistent TCP
// connection to the server for a subsequent "keep-alive" request.
if respBody != nil {
// Drain any remaining Body and then close the connection.
+1 -1
View File
@@ -118,7 +118,7 @@ const (
// Dummy putBucketACL
AmzACL = "x-amz-acl"
// Signature V4 related contants.
// Signature V4 related constants.
AmzContentSha256 = "X-Amz-Content-Sha256"
AmzDate = "X-Amz-Date"
AmzAlgorithm = "X-Amz-Algorithm"
+1 -1
View File
@@ -32,7 +32,7 @@ type acceptResult struct {
// httpListener - HTTP listener capable of handling multiple server addresses.
type httpListener struct {
tcpListeners []*net.TCPListener // underlaying TCP listeners.
tcpListeners []*net.TCPListener // underlying TCP listeners.
acceptCh chan acceptResult // channel where all TCP listeners write accepted connection.
ctx context.Context
ctxCanceler context.CancelFunc
+1 -1
View File
@@ -109,7 +109,7 @@ func (srv *Server) Init(listenCtx context.Context, listenErrCallback func(listen
wrappedHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// If server is in shutdown.
if atomic.LoadUint32(&srv.inShutdown) != 0 {
// To indicate disable keep-alives
// To indicate disable keep-alive
w.Header().Set("Connection", "close")
w.WriteHeader(http.StatusServiceUnavailable)
w.Write([]byte(http.ErrServerClosed.Error()))
+1 -1
View File
@@ -295,7 +295,7 @@ var copyBufPool = sync.Pool{
},
}
// Copy is exactly like io.Copy but with re-usable buffers.
// Copy is exactly like io.Copy but with reusable buffers.
func Copy(dst io.Writer, src io.Reader) (written int64, err error) {
bufp := copyBufPool.Get().(*[]byte)
buf := *bufp
+1 -1
View File
@@ -77,7 +77,7 @@ type Config struct {
LogOnce func(ctx context.Context, err error, id string, errKind ...interface{}) `json:"-"`
}
// Check if atleast one broker in cluster is active
// Check if at least one broker in cluster is active
func (k Config) pingBrokers() (err error) {
d := net.Dialer{Timeout: 1 * time.Second}
+2 -2
View File
@@ -34,7 +34,7 @@ func TestCrossDeviceMountPaths(t *testing.T) {
successCase := `/dev/0 /path/to/0/1 type0 flags 0 0
/dev/1 /path/to/1 type1 flags 1 1
/dev/2 /path/to/1/2 type2 flags,1,2=3 2 2
/dev/3 /path/to/1.1 type3 falgs,1,2=3 3 3
/dev/3 /path/to/1.1 type3 flags,1,2=3 3 3
`
var err error
dir := t.TempDir()
@@ -83,7 +83,7 @@ func TestCrossDeviceMount(t *testing.T) {
successCase := `/dev/0 /path/to/0/1 type0 flags 0 0
/dev/1 /path/to/1 type1 flags 1 1
/dev/2 /path/to/1/2 type2 flags,1,2=3 2 2
/dev/3 /path/to/1.1 type3 falgs,1,2=3 3 3
/dev/3 /path/to/1.1 type3 flags,1,2=3 3 3
`
var err error
dir := t.TempDir()
+1 -1
View File
@@ -194,7 +194,7 @@ func TestMultiPubSubMask(t *testing.T) {
select {
case msg := <-ch3:
t.Fatalf(fmt.Sprintf("unexpect msg, f got %s", msg))
t.Fatalf(fmt.Sprintf("unexpected msg, f got %s", msg))
default:
}
}
+1 -1
View File
@@ -125,7 +125,7 @@ func removeEmptyPort(host string) string {
return host
}
// Copied from http.NewRequest but implemented to ensure we re-use `url.URL` instance.
// Copied from http.NewRequest but implemented to ensure we reuse `url.URL` instance.
func (c *Client) newRequest(ctx context.Context, u url.URL, body io.Reader) (*http.Request, error) {
rc, ok := body.(io.ReadCloser)
if !ok && body != nil {
+1 -1
View File
@@ -202,7 +202,7 @@ type Between struct {
}
// In represents the RHS of an IN expression. The RHS can be a list-literal
// (i.e. enclosed in parantheses like `IN (1,2,4)`) or it could be a JSON path
// (i.e. enclosed in parentheses like `IN (1,2,4)`) or it could be a JSON path
// expression (as in `8.5 IN s.nested[*][*]`). Specifically, it cannot be an
// `Expression` as an expression can never evaluate to a list.
type In struct {
+1 -1
View File
@@ -41,7 +41,7 @@ func TestJSONPathElement(t *testing.T) {
// Index
"[2]", "[0]", "[100]",
// Object wilcard
// Object wildcard
".*",
// array wildcard