Skip to content

Remove duplicate TLS declarations in internal/httputil#7887

Merged
lpcox merged 2 commits into
mainfrom
copilot/duplicate-code-fix-tls-declarations
Jun 21, 2026
Merged

Remove duplicate TLS declarations in internal/httputil#7887
lpcox merged 2 commits into
mainfrom
copilot/duplicate-code-fix-tls-declarations

Conversation

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

internal/httputil contained two copies of the same TLS helpers and tests, causing package-level redeclaration errors and preventing the package from compiling. This change consolidates the package back to a single implementation and a single test file.

  • Remove duplicate package declarations

    • Delete internal/httputil/tls_config.go
    • Keep internal/httputil/tls.go as the single source of truth for:
      • MinTLSVersion
      • NewServerTLSConfig
      • NewClientTLSConfig
  • Collapse duplicate tests

    • Delete internal/httputil/tls_config_test.go
    • Preserve the only distinct assertion from the duplicate test file by adding assert.NotNil checks to internal/httputil/tls_test.go
  • Resulting package shape

    • One implementation file defines the TLS defaults
    • One test file validates the server and client helpers without duplicate symbols
func TestNewServerTLSConfig(t *testing.T) {
	cert := tls.Certificate{Certificate: [][]byte{[]byte("leaf-cert")}}

	cfg := NewServerTLSConfig(cert)

	assert.NotNil(t, cfg)
	assert.EqualValues(t, MinTLSVersion, cfg.MinVersion)
	assert.Len(t, cfg.Certificates, 1)
	assert.Equal(t, cert, cfg.Certificates[0])
}

GitHub Advanced Security started work on behalf of lpcox June 21, 2026 16:26 View session
GitHub Advanced Security finished work on behalf of lpcox June 21, 2026 16:28
GitHub Advanced Security started work on behalf of lpcox June 21, 2026 16:29 View session
GitHub Advanced Security finished work on behalf of lpcox June 21, 2026 16:31
Copilot AI changed the title [WIP] Fix duplicate TLS declarations in internal/httputil package Remove duplicate TLS declarations in internal/httputil Jun 21, 2026
Copilot AI requested a review from lpcox June 21, 2026 16:32
Copilot finished work on behalf of lpcox June 21, 2026 16:32
@lpcox lpcox marked this pull request as ready for review June 21, 2026 17:10
Copilot AI review requested due to automatic review settings June 21, 2026 17:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes internal/httputil build failures caused by duplicate TLS helper and test declarations by consolidating the package back to a single implementation (tls.go) and a single test file (tls_test.go).

Changes:

  • Remove the duplicate TLS helper implementation by deleting internal/httputil/tls_config.go.
  • Remove the duplicate TLS tests by deleting internal/httputil/tls_config_test.go.
  • Preserve the only distinct assertion from the duplicate tests by adding assert.NotNil checks to internal/httputil/tls_test.go.
Show a summary per file
File Description
internal/httputil/tls_test.go Adds missing assert.NotNil coverage for the returned TLS configs to retain the unique assertion from the deleted duplicate test file.
internal/httputil/tls_config.go Deletes the redundant TLS helper definitions that caused package-level redeclaration errors.
internal/httputil/tls_config_test.go Deletes the redundant TLS test file to eliminate duplicate test symbol definitions.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

@lpcox lpcox merged commit 8725239 into main Jun 21, 2026
40 checks passed
@lpcox lpcox deleted the copilot/duplicate-code-fix-tls-declarations branch June 21, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants