smarthttp_test: satisfy errcheck + revive on new tests · Entire
smarthttp_test: satisfy errcheck + revive on new tests
9beeb9a→main·
nodo·2mo ago·1 file·+8 added/-4 removed
golangci-lint v2.11.4 (matches CI) flagged the discarded w.Write returns and unused *http.Request parameter in the two new FollowInfoRefsRedirect tests.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Changes
1
internal/gitproto
Msmarthttp_test.go+8/-4
177 unmodified lines
178
179
180
181
181
182
183
183
184
185
186
187
188
22 unmodified lines
211
212
213
212
214
215
214
216
217
218
219
220
221
177 unmodified lines
// behaviour and lets clients use a cluster entry domain for info/refs while
// packs land on the hosting replica.
func TestRequestInfoRefs_FollowInfoRefsRedirect(t *testing.T) {
node := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
node := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/x-git-upload-pack-advertisement")
_, _ = w.Write([]byte("001e# service=git-upload-pack\n0000"))
if _, err := w.Write([]byte("001e# service=git-upload-pack\n0000")); err != nil {
t.Errorf("node write: %v", err)
}
}))
defer node.Close()
22 unmodified lines
// TestRequestInfoRefs_DoesNotFollowByDefault confirms the default behaviour
// is unchanged: Endpoint is stable even if the server 307s.
func TestRequestInfoRefs_DoesNotFollowByDefault(t *testing.T) {
node := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
node := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/x-git-upload-pack-advertisement")
_, _ = w.Write([]byte("001e# service=git-upload-pack\n0000"))
if _, err := w.Write([]byte("001e# service=git-upload-pack\n0000")); err != nil {
t.Errorf("node write: %v", err)
}
}))
defer node.Close()
Minternal/gitproto/smarthttp_test.go+8/-4