Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Removed
- Remove backport.yml and dependabot_pr.yml as we are not using backport app anymore
- Remove the deprecated `opensearch.ToPointer` generic helper ([#871](https://github.com/opensearch-project/opensearch-go/issues/871))

### Fixed

Expand Down
14 changes: 14 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [DiscoverNodes() blocking semantics](#discovernodes-blocking-semantics)
- [opensearchtransport.Route interface gained OpID()](#opensearchtransportroute-interface-gained-opid)
- [Response.Body becomes a method](#responsebody-becomes-a-method)
- [`opensearch.ToPointer` removed](#opensearchtopointer-removed)
- [Upgrading to >= 4.7.0](#upgrading-to->=-4.7.0)
- [opensearch.Request interface signature change](#opensearchrequest-interface-signature-change)
- [Path segment values are percent-encoded](#path-segment-values-are-percent-encoded)
Expand Down Expand Up @@ -154,6 +155,19 @@ body, err := io.ReadAll(resp.Body())
raw := resp.RawBody()
```

### `opensearch.ToPointer` removed

The deprecated `opensearch.ToPointer` generic helper has been removed. Replace calls with a one-line helper or, on Go 1.26+, use the native `new(value)` form:

```go
// Before
p := opensearch.ToPointer(true)

// After — define a one-line local helper:
func ptr[V any](v V) *V { return &v }
p := ptr(true)
```

## Upgrading to >= 4.7.0

### `opensearch.Request` interface signature change
Expand Down
19 changes: 0 additions & 19 deletions opensearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,22 +643,3 @@ func extractCredentialsFromURLs(cfg *Config, urls []*url.URL) {
}
}

// ToPointer converts any value to a pointer, mainly used for request parameters
//
// Deprecated: ToPointer will be removed in v5. The helper is intentionally not
// part of the public API going forward; consumers within this module use the
// unexported `ptr` defined per-package. Once the module's go directive moves
// to 1.26, callers can drop any wrapper in favor of the native new(value)
// form (e.g. new(false)).
func ToPointer[V any](value V) *V {
return ptr(value)
}

// ptr returns a pointer to a copy of value. Used for the *T query/body
// parameter pattern. Unexported by design.
//
// Once the module's go directive moves to 1.26, this helper can be deleted
// and call sites can switch to the native new(value) form: new(false).
func ptr[V any](value V) *V {
return &value
}
6 changes: 0 additions & 6 deletions opensearch_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,6 @@ func TestParseElasticsearchVersion(t *testing.T) {
}
}

func TestToPointer(t *testing.T) {
testPointer := ToPointer(true)
require.NotNil(t, testPointer)
require.True(t, *testPointer)
}

func TestClientGetConfig(t *testing.T) {
t.Run("returns config", func(t *testing.T) {
expectedAddresses := []string{"http://localhost:9200"}
Expand Down
Loading