Skip to content

Commit f4da3c3

Browse files
committed
fixup: drop http2 import to keep go.mod unchanged
The typed http2.StreamError check promoted golang.org/x/net to a direct dependency, failing the lint check that go.mod is unchanged. Rely on string match alone — http2.StreamError.Error() formats as "stream error: stream ID N; ..." which the existing string match catches. Co-authored-by: Isaac
1 parent 59773c1 commit f4da3c3

2 files changed

Lines changed: 6 additions & 16 deletions

File tree

experimental/ssh/internal/client/releases.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/databricks/cli/libs/filer"
1616
"github.com/databricks/cli/libs/log"
1717
"github.com/databricks/databricks-sdk-go"
18-
"golang.org/x/net/http2"
1918
)
2019

2120
type releaseProvider func(ctx context.Context, architecture, version, releasesDir string) (io.ReadCloser, error)
@@ -84,12 +83,9 @@ func uploadReleases(ctx context.Context, workspaceFiler filer.Filer, getRelease
8483

8584
// isStreamResetError reports whether err looks like an HTTP/2 stream reset from
8685
// the server, which typically means an edge proxy or the workspace-files import
87-
// endpoint rejected the request body (e.g. body-size limit).
86+
// endpoint rejected the request body (e.g. body-size limit). Matches both the
87+
// raw http2.StreamError.Error() format and wrapped variants.
8888
func isStreamResetError(err error) bool {
89-
var se http2.StreamError
90-
if errors.As(err, &se) {
91-
return true
92-
}
9389
msg := err.Error()
9490
return strings.Contains(msg, "stream error") && strings.Contains(msg, "stream ID")
9591
}

experimental/ssh/internal/client/releases_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"testing"
77

88
"github.com/stretchr/testify/assert"
9-
"golang.org/x/net/http2"
109
)
1110

1211
func TestIsStreamResetError(t *testing.T) {
@@ -16,18 +15,13 @@ func TestIsStreamResetError(t *testing.T) {
1615
want bool
1716
}{
1817
{
19-
name: "http2 stream error type",
20-
err: http2.StreamError{StreamID: 15, Code: http2.ErrCodeNo},
18+
name: "raw http2 stream error string",
19+
err: errors.New("stream error: stream ID 15; NO_ERROR"),
2120
want: true,
2221
},
2322
{
24-
name: "wrapped http2 stream error type",
25-
err: fmt.Errorf("post failed: %w", http2.StreamError{StreamID: 15, Code: http2.ErrCodeNo}),
26-
want: true,
27-
},
28-
{
29-
name: "string match from peer reset (Go HTTP/2 client format)",
30-
err: errors.New(`Post "https://example/api/2.0/workspace-files/import-file/...": stream error: stream ID 15; NO_ERROR; received from peer`),
23+
name: "wrapped peer-reset error (Go HTTP/2 client format)",
24+
err: fmt.Errorf(`Post "https://example/api/2.0/workspace-files/import-file/...": %w`, errors.New("stream error: stream ID 15; NO_ERROR; received from peer")),
3125
want: true,
3226
},
3327
{

0 commit comments

Comments
 (0)