[Repo Assist] fix(httputil): remove duplicate TLS declarations#7878
Merged
Conversation
tls_config.go and tls_config_test.go both redeclared MinTLSVersion, NewServerTLSConfig, and NewClientTLSConfig that are already defined in tls.go and tls_test.go — causing a compile error. Keep tls.go (has more detailed godoc) and tls_test.go. Absorb the assert.NotNil checks from tls_config_test.go into tls_test.go before deleting the duplicate files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR resolves a Go compile-time redeclaration failure in internal/httputil by removing the duplicate TLS helper implementation and its duplicate tests, leaving a single authoritative tls.go/tls_test.go pair.
Changes:
- Delete
internal/httputil/tls_config.go, which duplicated exported TLS declarations already present ininternal/httputil/tls.go. - Delete
internal/httputil/tls_config_test.go, which duplicated test function declarations. - Preserve test coverage by adding
assert.NotNilchecks intointernal/httputil/tls_test.go.
Show a summary per file
| File | Description |
|---|---|
| internal/httputil/tls_test.go | Adds assert.NotNil assertions so coverage from the removed duplicate test file is retained. |
| internal/httputil/tls_config.go | Deleted to remove duplicate exported TLS identifiers that caused redeclaration compile errors. |
| internal/httputil/tls_config_test.go | Deleted to remove duplicate test function declarations that also caused redeclaration errors. |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR is from Repo Assist, an automated AI assistant for this repository.
Closes #7862
Root Cause
After PR #7834 was merged (which introduced
internal/httputil/tls.go), a second fileinternal/httputil/tls_config.gowas added to the same package with identical declarations forMinTLSVersion,NewServerTLSConfig, andNewClientTLSConfig. Go does not permit two files in the same package to define the same exported identifiers — this causes a compile error:Fix
internal/httputil/tls_config.go—tls.gois kept as it has more detailed godocinternal/httputil/tls_config_test.go—tls_test.gois keptassert.NotNilchecks fromtls_config_test.gointotls_test.goso no test coverage is lostNo production logic changes — only the duplicate file is removed.
Test Status
proxy.golang.orgis blocked by the environment firewall, preventinggo build ./...andgo test ./....Manual verification performed:
go tool compile -e internal/httputil/tls.go— after removingtls_config.go, no redeclaration errors remain (only the expected "could not import crypto/tls" from the isolated invocation context)gofmt -d internal/httputil/tls.go internal/httputil/tls_test.go— clean, no diffsWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgSee Network Configuration for more information.
Add this agentic workflows to your repo
To install this agentic workflow, run