Skip to content

Commit 9d56cba

Browse files
authored
Feature: Idiomatic lib (#421)
* Update golangci-lint config Signed-off-by: Jakob Hahn <[email protected]> * opensearch: Add type Request Signed-off-by: Jakob Hahn <[email protected]> * opensearch: Add type Response Signed-off-by: Jakob Hahn <[email protected]> * opensearch: Remove test for ElasticearchURL env Signed-off-by: Jakob Hahn <[email protected]> * opensearch: add Do() func to client, remove elastic url env, remove API type from client Signed-off-by: Jakob Hahn <[email protected]> * opensearch.go: remove init func, add err vars, solve linting complains Signed-off-by: Jakob Hahn <[email protected]> * go: Update to 1.20 Signed-off-by: Jakob Hahn <[email protected]> * opensearch: Add BuildRequest function Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Remove all old api files Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add api,error and inspect file Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add internal package Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add catClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add Bulk Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add Info Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add Index Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add Search Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add indices create,delete,exists Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add missing indices endpoints Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add nodes client Signed-off-by: Jakob Hahn <[email protected]> * opensearchutil: Adjust bulk_indexer to new opensearchapi functions Signed-off-by: Jakob Hahn <[email protected]> * tests: Adjust to new openearchapi client and functions Signed-off-by: Jakob Hahn <[email protected]> * DEVELOPDER_GUID: Update links and go version Signed-off-by: Jakob Hahn <[email protected]> * internal: Remove build Signed-off-by: Jakob Hahn <[email protected]> * opensearchutil: Solve linting complains Signed-off-by: Jakob Hahn <[email protected]> * internal: Solve linting complains Signed-off-by: Jakob Hahn <[email protected]> * opensearch: Solve linting complains Signed-off-by: Jakob Hahn <[email protected]> * Update USER_GUIDE Signed-off-by: Jakob Hahn <[email protected]> * signer: Add missing comment to SignRequest func Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add cluster client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: init sub clients of indices Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add dangling client and functions Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add script client and functions Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add dangling and skipt client to root client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add document client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add documentClient to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add component template client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add index template client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add datastream client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add indexTemplate,componentTemplate,dataStream clinets to root client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add template client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add template client to root client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add aliases to root client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add ping function to root client Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add pointInTimeClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add pointInTimeClient to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add ingestClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add ingestClient to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add reindex funtion to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: Add tasksClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add tasksClient to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add mget function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add msearch function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add msearch template function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add mtermvercors function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add rank_eval function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add reindex rethrottle function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add render search template function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add scrollClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add scrollClient to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add ResponseShards struct Signed-off-by: Jakob Hahn <[email protected]> * Makefile: Update golangci-lint version Signed-off-by: Jakob Hahn <[email protected]> * opensearchtransport: solve linting complains Signed-off-by: Jakob Hahn <[email protected]> * signer: solve linting complains Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add _search_shards function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add search/template function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add snapshotClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add snapshotClient to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add termvactor function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add update function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add update_by_query function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: add UpdateByQueryRethrottle function to rootClient Signed-off-by: Jakob Hahn <[email protected]> * guids: updated to new opensearchapi functions Signed-off-by: Jakob Hahn <[email protected]> * changelog: add changes Signed-off-by: Jakob Hahn <[email protected]> * workflows: Skip json compare for integ test against unreleased opensearch Signed-off-by: Jakob Hahn <[email protected]> * opensearchapi: update license header Signed-off-by: Jakob Hahn <[email protected]> * github: update license header txt Signed-off-by: Jakob Hahn <[email protected]> * github: remove govulncheck workflow Signed-off-by: Jakob Hahn <[email protected]> * UPGRADING: add differences of 3.0.0 release Signed-off-by: Jakob Hahn <[email protected]> --------- Signed-off-by: Jakob Hahn <[email protected]>
1 parent 65a0c8e commit 9d56cba

File tree

583 files changed

+33664
-58900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

583 files changed

+33664
-58900
lines changed

.github/license-header.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@
33
// The OpenSearch Contributors require contributions made to
44
// this file be licensed under the Apache-2.0 license or a
55
// compatible open source license.
6-
//
7-
// Modifications Copyright OpenSearch Contributors. See
8-
// GitHub history for details.

.github/workflows/govulncheck.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/test-integration-unreleased.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ jobs:
6666
- name: Integration test
6767
working-directory: go-client
6868
run: make test-integ race=true
69+
env:
70+
OPENSEARCH_GO_SKIP_JSON_COMPARE: true
6971

7072
- name: Save server logs
7173
if: failure()

.golangci.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
run:
22
timeout: 10m
33
modules-download-mode: readonly
4-
issues-exit-code: 0
54

65
linters-settings:
76
errcheck:
@@ -37,11 +36,21 @@ linters-settings:
3736
check-exported: true
3837
misspell:
3938
locale: US
40-
ignore-words: expect
39+
ignore-words:
40+
- expect
41+
- cancelled
4142
prealloc:
4243
simple: true
4344
range-loops: true
4445
for-loops: false
46+
revive:
47+
rules:
48+
- name: exported
49+
severity: error
50+
disabled: false
51+
arguments:
52+
- "checkPrivateReceivers"
53+
- "sayRepetitiveInsteadOfStutters"
4554

4655
linters:
4756
disable-all: true
@@ -76,7 +85,6 @@ linters:
7685
- gofumpt
7786
- goheader
7887
- goimports
79-
- gomnd
8088
- gomoddirectives
8189
- gomodguard
8290
- goprintffuncname
@@ -124,16 +132,18 @@ linters:
124132
- zerologlint
125133

126134
issues:
135+
include:
136+
- EXC0012
137+
- EXC0014
127138
exclude-rules:
128-
- path: _test\.go
139+
- path: (_test\.go|opensearchapi/internal)
129140
linters:
130141
- cyclop
131142
- dupl
132143
- errcheck
133144
- gochecknoglobals
134145
- gochecknoinits
135146
- goconst
136-
- gomnd
137147
- noctx
138148
- linters:
139149
- gosec
@@ -149,16 +159,17 @@ issues:
149159
path: _test\.go
150160
- linters:
151161
- goconst
152-
text: "string `true` has"
153162
path: opensearchapi\/api_
154163
- linters:
155164
- errcheck
156165
text: "Error return value of `debugLogger.Logf` is not checked"
157166
- linters:
158167
- errcheck
159-
- gomnd
160168
- gochecknoglobals
161169
path: opensearchtransport\/logger\.go
162170
- linters:
163171
- nestif
164172
path: opensearchtransport/opensearchtransport.go
173+
- linters:
174+
- dupl
175+
path: (-params\.go|api_indices|api_dangling\.go|api_point_in_time\.go|rethrottle\.go|api_cat-.*\.go)

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1818
- Adds `Err()` function to Response for detailed errors ([#246](https://github.com/opensearch-project/opensearch-go/pull/246))
1919
- Adds golangci-lint as code analysis tool ([#313](https://github.com/opensearch-project/opensearch-go/pull/313))
2020
- Adds govulncheck to check for go vulnerablities ([#405](https://github.com/opensearch-project/opensearch-go/pull/405))
21+
- Adds opensearchapi with new client and function structure ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
22+
- Adds integration tests for all opensearchapi functions ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
2123

2224
### Changed
2325

@@ -27,18 +29,25 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
2729
- Updated Developer guide to include docker build instructions ([#385](https://github.com/opensearch-project/opensearch-go/pull/385))
2830
- Test against version 2.9.0,2.10.0, run tests in all branches, change intergration tests to wait for OpenSearch to start ([#392](https://github.com/opensearch-project/opensearch-go/pull/392))
2931
- Makefile: use docker golangci-lint, run integration test on `.` folder, change coverage generation ([#392](https://github.com/opensearch-project/opensearch-go/pull/392))
32+
- golangci-lint: update rules and fail when issues are found ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
33+
- go: update to golang version 1.20 ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
34+
- guids: updated to work for the new opensearchapi ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
35+
- Test adjusted to new opensearchapi functions and structs ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
3036

3137
### Deprecated
3238

3339
- Deprecate legacy API /_template ([#390](https://github.com/opensearch-project/opensearch-go/pull/390))
3440

3541
### Removed
3642

43+
- Removes all old opensearchapi functions ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
44+
- Removes /internal/build code and folders ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
45+
3746
### Fixed
3847

3948
- Corrects AWSv4 signature on DataStream Stats with no index name specified ([#338](https://github.com/opensearch-project/opensearch-go/pull/338))
4049
- Fixed GetSourceRequest `Source` field and deprecated the `Source` parameter ([#402](https://github.com/opensearch-project/opensearch-go/pull/402))
4150

4251
### Security
4352

44-
[Unreleased]: https://github.com/opensearch-project/opensearch-go/compare/v2.3.0...HEAD
53+
[Unreleased]: https://github.com/opensearch-project/opensearch-go/compare/v2.3.0...HEAD

DEVELOPER_GUIDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ Fork [opensearch-project/opensearch-go](https://github.com/opensearch-project/op
2929

3030
### Install Prerequisites
3131

32-
#### Go 1.15
32+
#### Go 1.20
3333

34-
OpenSearch Go Client builds using [Go](https://golang.org/doc/install) 1.15 at a minimum.
34+
OpenSearch Go Client builds using [Go](https://go.dev/doc/install) 1.20 at a minimum.
3535

3636
#### Docker
3737

38-
[Docker](https://docs.docker.com/install/) is required for building some OpenSearch artifacts and executing integration tests.
38+
[Docker](https://docs.docker.com/get-docker/) is required for building some OpenSearch artifacts and executing integration tests.
3939

4040
#### Windows
4141

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ lint: ## Run lint on the package
7272
@printf "\033[2m→ Running lint...\033[0m\n"
7373
go vet github.com/opensearch-project/opensearch-go/...
7474
go list github.com/opensearch-project/opensearch-go/... | 'grep' -v internal | xargs golint -set_exit_status
75-
@{ \
76-
set -e ; \
77-
trap "test -d ../../../.git && git checkout --quiet go.mod" INT TERM EXIT; \
78-
echo "cd internal/build/ && go vet ./..."; \
79-
cd "internal/build/" && go mod tidy && go mod download && go vet ./...; \
80-
}
8175

8276
package := "prettier"
8377
lint.markdown:
@@ -218,7 +212,7 @@ cluster.clean: ## Remove unused Docker volumes and networks
218212
docker system prune --volumes --force
219213

220214
linters:
221-
docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/v1.53.3:/root/.cache -w /app golangci/golangci-lint:v1.53.3 golangci-lint run --timeout=5m
215+
docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/v1.54.2:/root/.cache -w /app golangci/golangci-lint:v1.54.2 golangci-lint run --timeout=5m
222216

223217
workflow: ## Run all github workflow commands here sequentially
224218

0 commit comments

Comments
 (0)