ronantakizawa/codereview-bench huggingface dataset:
Repository: toss/es-toolkit
File: src/string/trimEnd.spec.ts (TypeScript)

Code before:
  it('should remove numbers from the end of a string', () => {
    expect(trimEnd('abc123456', '6')).toEqual('abc12345');
  });

  it('should handle cases where multiple trailing characters need removal', () => {
    expect(trimEnd('abc123abc123abc', 'c')).toEqual('abc123abc123ab');
  });

  it('should trim the string without giving the second parameter, which defaults to whitespace', () => {
    expect(trimEnd('  hello world  ')).toEqual('  hello world');
  });

  it('should remove trailing characters when chars is an array', () => {
    expect(trimEnd('hello---', ['-', 'o'])).toEqual('hell');
  });

  it('should remove trailing characters from the string when multiple characters are provided in an array', () => {
    expect(trimEnd('123000', ['0', '3'])).toEqual('12');
  });

  it('should return the string unchanged when none of the trailing characters in the array match', () => {
    expect(trimEnd('hello', ['x', 'y', 'z'])).toEqual('hello');
  });

  it('should handle cases where multiple trailing characters in the array need removal', () => {
    expect(trimEnd('abcabcabc', ['c', 'b'])).toEqual('a');
  });
});


Review comment (suggestion):
```suggestion
    expect(trimEnd('abcabcabc', ['c', 'b'])).toEqual('abcabca');
```

Code after:
  it('should remove numbers from the end of a string', () => {
    expect(trimEnd('abc123456', '6')).toEqual('abc12345');
  });

  it('should handle cases where multiple trailing characters need removal', () => {
    expect(trimEnd('abc123abc123abc', 'c')).toEqual('abc123abc123ab');
  });

  it('should trim the string without giving the second parameter, which defaults to whitespace', () => {
    expect(trimEnd('  hello world  ')).toEqual('  hello world');
  });

  it('should remove trailing characters when chars is an array', () => {
    expect(trimEnd('hello---', ['-', 'o'])).toEqual('hell');
  });

  it('should remove trailing characters from the string when multiple characters are provided in an array', () => {
    expect(trimEnd('123000', ['0', '3'])).toEqual('12');
  });

  it('should return the string unchanged when none of the trailing characters in the array match', () => {
    expect(trimEnd('hello', ['x', 'y', 'z'])).toEqual('hello');
  });

  it('should handle cases where multiple trailing characters in the array need removal', () => {
    expect(trimEnd('abcabcabc', ['c', 'b'])).toEqual('abcabca');
  });
});
Repository: toss/es-toolkit
File: src/compat/array/forEachRight.ts (TypeScript)

Code before:
 *
 * @template T - The type of object.
 * @param {T} object - The object to iterate over.
 * @param {(value: T[keyof T], key: keyof T, object: T) => unknown} [callback] - The function invoked for each property.
 * The callback function receives three arguments:
 *  - 'value': The current property being processed in the object.
 *  - 'key': The key of the current property being processed in the object.
 *  - 'object': The object 'forEachRight' was called upon.
 * @returns {T} Returns the original object.
 *
 * @example
 * forEachRight({'a': 1, 'b': 2 }, (value, key, object) => console.log(value, key));
 * // Output:
 * // 2 'b'
 * // 1 'a'
 */
export function forEachRight<T>(
  collection: ArrayLike<T> | Record<any, any> | string | null | undefined,
  callback: (item: any, index: any, arr: any) => unknown = identity
): ArrayLike<T> | Record<any, any> | string | null | undefined {
  if (!collection) {
    return collection;
  }

  const keys: PropertyKey[] =
    isArrayLike(collection) || Array.isArray(collection) ? range(0, collection.length) : Object.keys(collection);

  for (let i = keys.length - 1; i >= 0; i--) {
    const key = keys[i];
    const value = (collection as any)[key];

    const result = callback(value, key, collection);

    if (result === false) {
      break;
    }
  }

  return collection;
}


Review comment (suggestion):
```suggestion
    isArrayLike(collection) ? range(0, collection.length) : Object.keys(collection);
```

Code after:
 *
 * @template T - The type of object.
 * @param {T} object - The object to iterate over.
 * @param {(value: T[keyof T], key: keyof T, object: T) => unknown} [callback] - The function invoked for each property.
 * The callback function receives three arguments:
 *  - 'value': The current property being processed in the object.
 *  - 'key': The key of the current property being processed in the object.
 *  - 'object': The object 'forEachRight' was called upon.
 * @returns {T} Returns the original object.
 *
 * @example
 * forEachRight({'a': 1, 'b': 2 }, (value, key, object) => console.log(value, key));
 * // Output:
 * // 2 'b'
 * // 1 'a'
 */
export function forEachRight<T>(
  collection: ArrayLike<T> | Record<any, any> | string | null | undefined,
  callback: (item: any, index: any, arr: any) => unknown = identity
): ArrayLike<T> | Record<any, any> | string | null | undefined {
  if (!collection) {
    return collection;
  }

  const keys: PropertyKey[] =
    isArrayLike(collection) ? range(0, collection.length) : Object.keys(collection);

  for (let i = keys.length - 1; i >= 0; i--) {
    const key = keys[i];
    const value = (collection as any)[key];

    const result = callback(value, key, collection);

    if (result === false) {
      break;
    }
  }

  return collection;
}
Repository: toss/es-toolkit
File: src/array/maxBy.spec.ts (TypeScript)

Code before:
  });

  it('if there are two max values, first one is selected', () => {
    const people = [
      { name: 'Mark', age: 25 },
      { name: 'Nunu', age: 30 },
      { name: 'Overmars', age: 30 },
    ];
    const result = maxBy(people, person => person.age);
    expect(result).toEqual({ name: 'Nunu', age: 30 });
  });

  it('if array is single-element, return unique element of array', () => {
    const people = [{ name: 'Mark', age: 25 }];
    const result = maxBy(people, person => person.age);
    expect(result).toEqual({ name: 'Mark', age: 25 });
  });

  it('if array is empty, return undefined', () => {
    type Person = { name: string; age: number };
    const people: Person[] = [];
    const result = maxBy(people, person => person.age);
    expect(result).toBeUndefined();
  });

  it('should handle arrays with NaN values correctly', () => {
    const numbers = [1, Number.NaN, 3, 2];
    const result = maxBy(numbers, x => x);
    expect(result).toBe(3);
  });
});


Review comment (suggestion):
The description feels a bit too broad — it would be better to clarify that skipping `NaN` is the intended behavior.

Code after:
  });

  it('if there are two max values, first one is selected', () => {
    const people = [
      { name: 'Mark', age: 25 },
      { name: 'Nunu', age: 30 },
      { name: 'Overmars', age: 30 },
    ];
    const result = maxBy(people, person => person.age);
    expect(result).toEqual({ name: 'Nunu', age: 30 });
  });

  it('if array is single-element, return unique element of array', () => {
    const people = [{ name: 'Mark', age: 25 }];
    const result = maxBy(people, person => person.age);
    expect(result).toEqual({ name: 'Mark', age: 25 });
  });

  it('if array is empty, return undefined', () => {
    type Person = { name: string; age: number };
    const people: Person[] = [];
    const result = maxBy(people, person => person.age);
    expect(result).toBeUndefined();
  });

  it('should skip NaN values when comparing elements', () => {
    const numbers = [1, Number.NaN, 3, 2];
    const result = maxBy(numbers, x => x);
    expect(result).toBe(3);
  });
});
Repository: toss/es-toolkit
File: docs/.vitepress/shared.mts (TypeScript)

Code before:
        defer: "true",
      }
    ],
    [
      "script",
      {
        type: "module",
      },
      `
        import * as es from "https://cdn.jsdelivr.net/npm/es-toolkit@latest/+esm";
        import * as esCompat from "https://cdn.jsdelivr.net/npm/es-toolkit@latest/compat/+esm";
        window.es = es;
        window.esCompat = esCompat;
        setTimeout(() => {
          console.log(
            '%cTry es-toolkit in the console! 😃',
            'background: #0064FF; color: white; padding: 2px 4px; border-radius: 3px;'
          );
          console.log(
            '%cExample: es',
            'background: #0064FF; color: white; padding: 2px 4px; border-radius: 3px;'
          );
          console.log('%ces.at([10, 20, 30, 40, 50], [1, 3, 4]);', 'font-weight: bold;');
          console.log('%c// [20, 40, 50]', 'font-weight: bold;');
          console.log(
            '%cExample: esCompat',
            'background: #0064FF; color: white; padding: 2px 4px; border-radius: 3px;'
          );
          console.log('%cesCompat.concat([1, 2, 3], [4, 5, 6]);', 'font-weight: bold;');
          console.log('%c// [1, 2, 3, 4, 5, 6]', 'font-weight: bold;');
        }, 1000);
      `
    ],
    [
      "meta",
      {
        property: "og:image",
        content: "/og.png",
      },
    ],
  ],

  themeConfig: {
    logo: {
      dark: '/logo_white.png',
      light: '/logo_black.png',
    },

    siteTitle: false,

    search: {

Review comment (suggestion):
```suggestion
            '%cExample for es-toolkit/compat',
```

Code after:
        defer: "true",
      }
    ],
    [
      "script",
      {
        type: "module",
      },
      `
        import * as es from "https://cdn.jsdelivr.net/npm/es-toolkit@latest/+esm";
        import * as esCompat from "https://cdn.jsdelivr.net/npm/es-toolkit@latest/compat/+esm";
        window.es = es;
        window.esCompat = esCompat;
        setTimeout(() => {
          console.log(
            '%cTry es-toolkit in the console! 😃',
            'background: #0064FF; color: white; padding: 2px 4px; border-radius: 3px;'
          );
          console.log(
            '%cExample for es-toolkit',
            'background: #0064FF; color: white; padding: 2px 4px; border-radius: 3px;'
          );
          console.log('%ces.at([10, 20, 30, 40, 50], [1, 3, 4]);', 'font-weight: bold;');
          console.log('%c// [20, 40, 50]', 'font-weight: bold;');
          console.log(
            '%cExample for es-toolkit/compat',
            'background: #0064FF; color: white; padding: 2px 4px; border-radius: 3px;'
          );
          console.log('%cesCompat.concat([1, 2, 3], [4, 5, 6]);', 'font-weight: bold;');
          console.log('%c// [1, 2, 3, 4, 5, 6]', 'font-weight: bold;');
        }, 1000);
      `
    ],
    [
      "meta",
      {
        property: "og:image",
        content: "/og.png",
      },
    ],
  ],

  themeConfig: {
    logo: {
      dark: '/logo_white.png',
      light: '/logo_black.png',
    },

    siteTitle: false,

    search: {
Repository: toss/es-toolkit
File: src/compat/predicate/isMatchWith.ts (TypeScript)

Code before:
    default: {
      if (!isObject(target)) {
        return eq(target, source);
      }

      if (typeof source === 'string') {
        return source === '';
      }

      return true;
    }
  }
}

function isObjectMatch(
  target: any,
  source: any,
  compare: (
    objValue: any,
    srcValue: any,
    key: PropertyKey,
    object: any,
    source: any,
    stack?: Map<any, any>
  ) => boolean | undefined,
  stack?: Map<any, any>
): boolean {
  if (source == null) {
    return true;
  }

  if (Array.isArray(source)) {
    return isArrayMatch(target, source, compare, stack);
  }

  if (source instanceof Map) {
    return isMapMatch(target, source, compare, stack);
  }

  if (source instanceof Set) {
    return isSetMatch(target, source, compare, stack);
  }

  const keys = Object.keys(source as any);

  if (target == null) {
    return keys.length === 0;
  }

  if (keys.length === 0) {
    return true;

Review comment (suggestion):
```suggestion
  stack: Map<any, any> | undefined
```

`stack` should be a required parameter here (although it can be undefined)

Code after:
    default: {
      if (!isObject(target)) {
        return eq(target, source);
      }

      if (typeof source === 'string') {
        return source === '';
      }

      return true;
    }
  }
}

function isObjectMatch(
  target: any,
  source: any,
  compare: (
    objValue: any,
    srcValue: any,
    key: PropertyKey,
    object: any,
    source: any,
    stack?: Map<any, any>
  ) => boolean | undefined,
  stack: Map<any, any> | undefined
): boolean {
  if (source == null) {
    return true;
  }

  if (Array.isArray(source)) {
    return isArrayMatch(target, source, compare, stack);
  }

  if (source instanceof Map) {
    return isMapMatch(target, source, compare, stack);
  }

  if (source instanceof Set) {
    return isSetMatch(target, source, compare, stack);
  }

  const keys = Object.keys(source as any);

  if (target == null) {
    return keys.length === 0;
  }

  if (keys.length === 0) {
    return true;
Repository: toss/es-toolkit
File: src/compat/predicate/isMatchWith.ts (TypeScript)

Code before:

      const isEqual = compare(target[key], source[key], key, target, source, stack);

      if (!isEqual) {
        return false;
      }
    }

    return true;
  } finally {
    stack?.delete(source);
  }
}

function isMapMatch(
  target: unknown,
  source: Map<any, any>,
  compare: (
    objValue: any,
    srcValue: any,
    key: PropertyKey,
    object: any,
    source: any,
    stack?: Map<any, any>
  ) => boolean | undefined,
  stack?: Map<any, any>
): boolean {
  if (source.size === 0) {
    return true;
  }

  if (!(target instanceof Map)) {
    return false;
  }

  for (const [key, sourceValue] of source.entries()) {
    const targetValue = target.get(key);

    const isEqual = compare(targetValue, sourceValue, key, target, source, stack);

    if (isEqual === false) {
      return false;
    }
  }

  return true;
}

function isArrayMatch(
  target: unknown,
  source: readonly unknown[],

Review comment (suggestion):
```suggestion
  stack: Map<any, any> | undefined
```

Code after:

      const isEqual = compare(target[key], source[key], key, target, source, stack);

      if (!isEqual) {
        return false;
      }
    }

    return true;
  } finally {
    stack?.delete(source);
  }
}

function isMapMatch(
  target: unknown,
  source: Map<any, any>,
  compare: (
    objValue: any,
    srcValue: any,
    key: PropertyKey,
    object: any,
    source: any,
    stack?: Map<any, any>
  ) => boolean | undefined,
  stack: Map<any, any> | undefined
): boolean {
  if (source.size === 0) {
    return true;
  }

  if (!(target instanceof Map)) {
    return false;
  }

  for (const [key, sourceValue] of source.entries()) {
    const targetValue = target.get(key);

    const isEqual = compare(targetValue, sourceValue, key, target, source, stack);

    if (isEqual === false) {
      return false;
    }
  }

  return true;
}

function isArrayMatch(
  target: unknown,
  source: readonly unknown[],
Repository: toss/es-toolkit
File: src/compat/predicate/isMatchWith.ts (TypeScript)

Code before:

  for (const [key, sourceValue] of source.entries()) {
    const targetValue = target.get(key);

    const isEqual = compare(targetValue, sourceValue, key, target, source, stack);

    if (isEqual === false) {
      return false;
    }
  }

  return true;
}

function isArrayMatch(
  target: unknown,
  source: readonly unknown[],
  compare: (
    objValue: any,
    srcValue: any,
    key: PropertyKey,
    object: any,
    source: any,
    stack?: Map<any, any>
  ) => boolean | undefined,
  stack?: Map<any, any>
): boolean {
  if (source.length === 0) {
    return true;
  }

  if (!Array.isArray(target)) {
    return false;
  }

  const countedIndex = new Set<number>();

  for (let i = 0; i < source.length; i++) {
    const sourceItem = source[i];
    let found = false;

    for (let j = 0; j < target.length; j++) {
      if (countedIndex.has(j)) {
        continue;
      }

      const targetItem = target[j];
      let matches = false;

      const isEqual = compare(targetItem, sourceItem, i, target, source, stack);


Review comment (suggestion):
```suggestion
  stack: Map<any, any> | undefined
```

Code after:

  for (const [key, sourceValue] of source.entries()) {
    const targetValue = target.get(key);

    const isEqual = compare(targetValue, sourceValue, key, target, source, stack);

    if (isEqual === false) {
      return false;
    }
  }

  return true;
}

function isArrayMatch(
  target: unknown,
  source: readonly unknown[],
  compare: (
    objValue: any,
    srcValue: any,
    key: PropertyKey,
    object: any,
    source: any,
    stack?: Map<any, any>
  ) => boolean | undefined,
  stack: Map<any, any> | undefined
): boolean {
  if (source.length === 0) {
    return true;
  }

  if (!Array.isArray(target)) {
    return false;
  }

  const countedIndex = new Set<number>();

  for (let i = 0; i < source.length; i++) {
    const sourceItem = source[i];
    let found = false;

    for (let j = 0; j < target.length; j++) {
      if (countedIndex.has(j)) {
        continue;
      }

      const targetItem = target[j];
      let matches = false;

      const isEqual = compare(targetItem, sourceItem, i, target, source, stack);
Repository: toss/es-toolkit
File: src/function/retry.ts (TypeScript)

Code before:
  if (typeof _options === 'number') {
    delay = DEFAULT_DELAY;
    retries = _options;
    signal = undefined;
    shouldRetry = undefined;
  } else {
    delay = _options?.delay ?? DEFAULT_DELAY;
    retries = _options?.retries ?? DEFAULT_RETRIES;
    signal = _options?.signal;
    shouldRetry = _options?.shouldRetry;
  }

  let error;

  for (let attempts = 0; attempts < retries; attempts++) {
    if (signal?.aborted) {
      throw error ?? new Error(`The retry operation was aborted due to an abort signal.`);
    }

    try {
      return await func();
    } catch (err) {
      error = err;

      // Determine if we should retry based on the provided shouldRetry function
      if (shouldRetry && !shouldRetry(err, attempts)) {
        throw err;
      }

      const currentDelay = typeof delay === 'function' ? delay(attempts) : delay;
      await delayToolkit(currentDelay);
    }
  }

  throw error;
}


Review comment (suggestion):
```suggestion
      if (!shouldRetry(err, attempts)) {
```

Code after:

  if (typeof _options === 'number') {
    delay = DEFAULT_DELAY;
    retries = _options;
    signal = undefined;
    shouldRetry = DEFAULT_SHOULD_RETRY;
  } else {
    delay = _options?.delay ?? DEFAULT_DELAY;
    retries = _options?.retries ?? DEFAULT_RETRIES;
    signal = _options?.signal;
    shouldRetry = _options?.shouldRetry ?? DEFAULT_SHOULD_RETRY;
  }

  let error;

  for (let attempts = 0; attempts < retries; attempts++) {
    if (signal?.aborted) {
      throw error ?? new Error(`The retry operation was aborted due to an abort signal.`);
    }

    try {
      return await func();
    } catch (err) {
      error = err;

      // Determine if we should retry based on the provided shouldRetry function
      if (!shouldRetry(err, attempts)) {
        throw err;
      }

      const currentDelay = typeof delay === 'function' ? delay(attempts) : delay;
      await delayToolkit(currentDelay);
    }
  }

  throw error;
}
Repository: traefik/traefik
File: pkg/middlewares/metrics/metrics.go (Go)

Code before:
	var tlsVersion string

	switch req.TLS.Version {
	case tls.VersionTLS10:
		tlsVersion = "tls-1.0"
	case tls.VersionTLS11:
		tlsVersion = "tls-1.1"
	case tls.VersionTLS12:
		tlsVersion = "tls-1.2"
	case tls.VersionTLS13:
		tlsVersion = "tls-1.3"
	case tls.VersionSSL30: //nolint
		tlsVersion = "ssl-3.0"
	default:
		tlsVersion = "unknown"
	}

	return tlsVersion
}

func getRequestTLSCipher(req *http.Request) string {
	var tlsCipher string

	switch req.TLS.CipherSuite {
	case tls.TLS_RSA_WITH_RC4_128_SHA:
		tlsCipher = "TLS_RSA_WITH_RC4_128_SHA"
	case tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA:
		tlsCipher = "TLS_RSA_WITH_3DES_EDE_CBC_SHA"
	case tls.TLS_RSA_WITH_AES_128_CBC_SHA:
		tlsCipher = "TLS_RSA_WITH_AES_128_CBC_SHA"
	case tls.TLS_RSA_WITH_AES_256_CBC_SHA:
		tlsCipher = "TLS_RSA_WITH_AES_256_CBC_SHA"
	case tls.TLS_RSA_WITH_AES_128_CBC_SHA256:
		tlsCipher = "TLS_RSA_WITH_AES_128_CBC_SHA256"
	case tls.TLS_RSA_WITH_AES_128_GCM_SHA256:
		tlsCipher = "TLS_RSA_WITH_AES_128_GCM_SHA256"
	case tls.TLS_RSA_WITH_AES_256_GCM_SHA384:
		tlsCipher = "TLS_RSA_WITH_AES_256_GCM_SHA384"
	case tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:
		tlsCipher = "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA"
	case tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
		tlsCipher = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA"
	case tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
		tlsCipher = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA"
	case tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA:
		tlsCipher = "TLS_ECDHE_RSA_WITH_RC4_128_SHA"
	case tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:
		tlsCipher = "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA"
	case tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
		tlsCipher = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"
	case tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:

Review comment (suggestion):
```suggestion
		return "TLS_RSA_WITH_RC4_128_SHA"
```

Code after:
func getRequestTLSVersion(req *http.Request) string {
	switch req.TLS.Version {
	case tls.VersionTLS10:
		return "1.0"
	case tls.VersionTLS11:
		return "1.1"
	case tls.VersionTLS12:
		return "1.2"
	case tls.VersionTLS13:
		return "1.3"
	default:
		return "unknown"
	}
}

func getRequestTLSCipher(req *http.Request) string {
	if version, ok := traefiktls.CipherSuitesReversed[req.TLS.CipherSuite]; ok {
		return version
	}

	return "unknown"
}

type retryMetrics interface {
	ServiceRetriesCounter() gokitmetrics.Counter
}

// NewRetryListener instantiates a MetricsRetryListener with the given retryMetrics.
func NewRetryListener(retryMetrics retryMetrics, serviceName string) retry.Listener {
	return &RetryListener{retryMetrics: retryMetrics, serviceName: serviceName}
}

// RetryListener is an implementation of the RetryListener interface to
// record RequestMetrics about retry attempts.
type RetryListener struct {
	retryMetrics retryMetrics
	serviceName  string
}

// Retried tracks the retry in the RequestMetrics implementation.
func (m *RetryListener) Retried(req *http.Request, attempt int) {
	m.retryMetrics.ServiceRetriesCounter().With("service", m.serviceName).Add(1)
}
Repository: traefik/traefik
File: pkg/tls/cipher_test.go (Go)

Code before:
package tls

import (
	"testing"
)

func TestCiphersMapsSync(t *testing.T) {
	for k, v := range CipherSuites {
		// Following names are legacy aliases. We do not test for their presence
		// in CipherSuitesReversed
		switch k {
		case "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305":
			fallthrough
		case "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305":
			continue
		}

		if rv, ok := CipherSuitesReversed[v]; !ok {
			t.Errorf("Maps not in sync: `%v` key is missing in tls.CipherSuitesReversed", v)
		} else if k != rv {
			t.Errorf("Maps not in sync: tls.CipherSuites[%v] = `%v` AND tls.CipherSuitesReversed[`%v`] = `%v`", k, v, v, rv)
		}
	}

	for k, v := range CipherSuitesReversed {
		if rv, ok := CipherSuites[v]; !ok {
			t.Errorf("Maps not in sync: `%v` key is missing in tls.CipherSuites", v)
		} else if k != rv {
			t.Errorf("Maps not in sync: tls.CipherSuitesReversed[`%v`] = `%v` AND tls.CipherSuites[`%v`] = `%v`", k, v, v, rv)
		}
	}
}


Review comment (suggestion):
```suggestion
		switch k {
		case "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305":
			continue
		}
```

Code after:
package tls

import (
	"testing"
)

func TestCiphersMapsSync(t *testing.T) {
	for k, v := range CipherSuites {
		// Following names are legacy aliases.
		// We do not test for their presence in CipherSuitesReversed
		switch k {
		case "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305":
			continue
		}

		if rv, ok := CipherSuitesReversed[v]; !ok {
			t.Errorf("Maps not in sync: `%d` key is missing in tls.CipherSuitesReversed", v)
		} else if k != rv {
			t.Errorf("Maps not in sync: tls.CipherSuites[%s] = `%d` AND tls.CipherSuitesReversed[`%d`] = `%v`", k, v, v, rv)
		}
	}

	for k, v := range CipherSuitesReversed {
		if rv, ok := CipherSuites[v]; !ok {
			t.Errorf("Maps not in sync: `%s` key is missing in tls.CipherSuites", v)
		} else if k != rv {
			t.Errorf("Maps not in sync: tls.CipherSuitesReversed[`%d`] = `%s` AND tls.CipherSuites[`%s`] = `%d`", k, v, v, rv)
		}
	}
}