diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6718a2e..e09280f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,6 +16,8 @@ jobs: - '1.20' - '1.21' - '1.22' + - '1.23' + - '1.24' name: Go ${{ matrix.go }} test steps: - uses: actions/checkout@v2 diff --git a/dumper_test.go b/dumper_test.go index 52bd7d1..a00139d 100644 --- a/dumper_test.go +++ b/dumper_test.go @@ -398,29 +398,7 @@ func (ts *DumperSuite) TestPrivateFields(c *C) { }`) UnregisterCustomDumper(http.Request{}) - c.Assert(Sdump(http.Request{}), DumpEquals, `http.Request{ - Method: "", - URL: nil, // &url.URL - Proto: "", - ProtoMajor: 0, - ProtoMinor: 0, - Header: nil, // map[string][]string - Body: nil, - GetBody: nil, // func() (io.ReadCloser, error) - ContentLength: 0, // int64 - TransferEncoding: nil, // []string - Close: false, - Host: "", - Form: nil, // map[string][]string - PostForm: nil, // map[string][]string - MultipartForm: nil, // &multipart.Form - Trailer: nil, // map[string][]string - RemoteAddr: "", - RequestURI: "", - TLS: nil, // &tls.ConnectionState - Cancel: nil, // <-chan struct {} - Response: nil, // &http.Response -}`) + c.Assert(Sdump(http.Request{}), DumpEquals, httpRequestExceptedDump) RegisterCustomDumper(http.Request{}, DumpStructWithPrivateFields) c.Assert(Sdump(http.Request{}), DumpEquals, httpRequestExceptedDumpWithPrivateFields) diff --git a/dumper_test_http.go b/dumper_test_http.go index d9cd303..5d73ef3 100644 --- a/dumper_test_http.go +++ b/dumper_test_http.go @@ -2,6 +2,30 @@ package dumper +const httpRequestExceptedDump = `http.Request{ + Method: "", + URL: nil, // &url.URL + Proto: "", + ProtoMajor: 0, + ProtoMinor: 0, + Header: nil, // map[string][]string + Body: nil, + GetBody: nil, // func() (io.ReadCloser, error) + ContentLength: 0, // int64 + TransferEncoding: nil, // []string + Close: false, + Host: "", + Form: nil, // map[string][]string + PostForm: nil, // map[string][]string + MultipartForm: nil, // &multipart.Form + Trailer: nil, // map[string][]string + RemoteAddr: "", + RequestURI: "", + TLS: nil, // &tls.ConnectionState + Cancel: nil, // <-chan struct {} + Response: nil, // &http.Response +}` + const httpRequestExceptedDumpWithPrivateFields = `http.Request{ Method: "", URL: nil, // &url.URL diff --git a/dumper_test_http_122.go b/dumper_test_http_122.go index 0afe2ab..7813451 100644 --- a/dumper_test_http_122.go +++ b/dumper_test_http_122.go @@ -1,7 +1,31 @@ -//go:build go1.22 +//go:build go1.22 && !go1.23 package dumper +const httpRequestExceptedDump = `http.Request{ + Method: "", + URL: nil, // &url.URL + Proto: "", + ProtoMajor: 0, + ProtoMinor: 0, + Header: nil, // map[string][]string + Body: nil, + GetBody: nil, // func() (io.ReadCloser, error) + ContentLength: 0, // int64 + TransferEncoding: nil, // []string + Close: false, + Host: "", + Form: nil, // map[string][]string + PostForm: nil, // map[string][]string + MultipartForm: nil, // &multipart.Form + Trailer: nil, // map[string][]string + RemoteAddr: "", + RequestURI: "", + TLS: nil, // &tls.ConnectionState + Cancel: nil, // <-chan struct {} + Response: nil, // &http.Response +}` + const httpRequestExceptedDumpWithPrivateFields = `http.Request{ Method: "", URL: nil, // &url.URL diff --git a/dumper_test_http_123.go b/dumper_test_http_123.go new file mode 100644 index 0000000..9e89317 --- /dev/null +++ b/dumper_test_http_123.go @@ -0,0 +1,57 @@ +//go:build go1.23 + +package dumper + +const httpRequestExceptedDump = `http.Request{ + Method: "", + URL: nil, // &url.URL + Proto: "", + ProtoMajor: 0, + ProtoMinor: 0, + Header: nil, // map[string][]string + Body: nil, + GetBody: nil, // func() (io.ReadCloser, error) + ContentLength: 0, // int64 + TransferEncoding: nil, // []string + Close: false, + Host: "", + Form: nil, // map[string][]string + PostForm: nil, // map[string][]string + MultipartForm: nil, // &multipart.Form + Trailer: nil, // map[string][]string + RemoteAddr: "", + RequestURI: "", + TLS: nil, // &tls.ConnectionState + Cancel: nil, // <-chan struct {} + Response: nil, // &http.Response + Pattern: "", +}` + +const httpRequestExceptedDumpWithPrivateFields = `http.Request{ + Method: "", + URL: nil, // &url.URL + Proto: "", + ProtoMajor: 0, + ProtoMinor: 0, + Header: nil, // map[string][]string + Body: nil, + GetBody: nil, // func() (io.ReadCloser, error) + ContentLength: 0, // int64 + TransferEncoding: nil, // []string + Close: false, + Host: "", + Form: nil, // map[string][]string + PostForm: nil, // map[string][]string + MultipartForm: nil, // &multipart.Form + Trailer: nil, // map[string][]string + RemoteAddr: "", + RequestURI: "", + TLS: nil, // &tls.ConnectionState + Cancel: nil, // <-chan struct {} + Response: nil, // &http.Response + Pattern: "", + ctx: nil, + pat: nil, // &http.pattern + matches: nil, // []string + otherValues: nil, // map[string]string +}`