diff --git a/.github/workflows/build-quesma-docker-image.yml b/.github/workflows/build-quesma-docker-image.yml index c45892fec..162f8f591 100644 --- a/.github/workflows/build-quesma-docker-image.yml +++ b/.github/workflows/build-quesma-docker-image.yml @@ -45,7 +45,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: ${{ matrix.module }}/go.sum - go-version: '1.22' + go-version: '1.23' - name: Log in to Docker Hub uses: docker/login-action@v3 diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 413a7a8ae..13b0a3148 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -25,7 +25,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: smoke-test/go.sum - go-version: '1.22' + go-version: '1.23' - name: Download images uses: actions/download-artifact@v4 diff --git a/.github/workflows/generate-notice.yml b/.github/workflows/generate-notice.yml index b809f47dc..ef6fb4f89 100644 --- a/.github/workflows/generate-notice.yml +++ b/.github/workflows/generate-notice.yml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: ${{ matrix.module }}/go.sum - go-version: '1.22' + go-version: '1.23' - name: Install go-licence-detector working-directory: ${{ matrix.module }} diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index dce91702b..89d8505a1 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: smoke-test/go.sum - go-version: '1.22' + go-version: '1.23' - name: Download images uses: actions/download-artifact@v4 diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index fbffb37c6..fea8eedd2 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -28,7 +28,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: ${{ matrix.module }}/go.sum - go-version: '1.22' + go-version: '1.23' - name: gofmt working-directory: ${{ matrix.module }} @@ -57,7 +57,7 @@ jobs: - uses: dominikh/staticcheck-action@v1.3.1 with: - version: "2023.1.6" + version: "2024.1.1" install-go: false working-directory: ${{ matrix.module }} @@ -87,7 +87,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: ${{ matrix.module }}/go.sum - go-version: '1.22' + go-version: '1.23' - name: Build and export uses: docker/build-push-action@v6 @@ -117,7 +117,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: smoke-test/go.sum - go-version: '1.22' + go-version: '1.23' - name: Download images uses: actions/download-artifact@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a396e834..e67acba78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,7 +40,7 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: ${{ matrix.module }}/go.sum - go-version: '1.22' + go-version: '1.23' - name: Login to GCR (only for build running on `main` branch) uses: docker/login-action@v3 diff --git a/README.md b/README.md index acf1ebd00..0e97a0359 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@
diff --git a/ci/e2e-data-generator/go.mod b/ci/e2e-data-generator/go.mod index 0e3601531..121c96b0c 100644 --- a/ci/e2e-data-generator/go.mod +++ b/ci/e2e-data-generator/go.mod @@ -1,3 +1,3 @@ module quesma/e2e-data-generator -go 1.22.2 +go 1.23.2 diff --git a/quesma/go.mod b/quesma/go.mod index e8cd6832b..fa7d89670 100644 --- a/quesma/go.mod +++ b/quesma/go.mod @@ -1,6 +1,6 @@ module quesma -go 1.22.5 +go 1.23.2 require ( github.com/ClickHouse/clickhouse-go/v2 v2.29.0 diff --git a/quesma/optimize/cache_queries.go b/quesma/optimize/cache_queries.go index 10e33dc72..881bd64d2 100644 --- a/quesma/optimize/cache_queries.go +++ b/quesma/optimize/cache_queries.go @@ -42,7 +42,7 @@ func (s *cacheQueries) Transform(queries []*model.Query, properties map[string]s visitor.OverrideVisitSelectCommand = func(v *model.BaseExprVisitor, query model.SelectCommand) interface{} { - if query.GroupBy != nil && len(query.GroupBy) > 0 { + if len(query.GroupBy) > 0 { hasGroupBy = true } diff --git a/quesma/queryparser/pancake_sql_query_generation.go b/quesma/queryparser/pancake_sql_query_generation.go index eb771e1c7..81a32c141 100644 --- a/quesma/queryparser/pancake_sql_query_generation.go +++ b/quesma/queryparser/pancake_sql_query_generation.go @@ -147,7 +147,7 @@ func (p *pancakeSqlQueryGenerator) generateBucketSqlParts(query *pancakeModel, b countAliasedColumn := model.NewAliasedExpr(countColumn, bucketAggregation.InternalNameForCount()) addSelectColumns = append(addSelectColumns, countAliasedColumn) - if bucketAggregation.orderBy != nil && len(bucketAggregation.orderBy) > 0 { + if len(bucketAggregation.orderBy) > 0 { rankOrderBy := make([]model.OrderByExpr, 0) for i, orderBy := range bucketAggregation.orderBy { diff --git a/quesma/queryparser/pancake_transformer.go b/quesma/queryparser/pancake_transformer.go index 8238c0c48..63b7a62d8 100644 --- a/quesma/queryparser/pancake_transformer.go +++ b/quesma/queryparser/pancake_transformer.go @@ -375,7 +375,7 @@ func (a *pancakeTransformer) createTopHitAndTopMetricsPancakes(pancake *pancakeM } func (a *pancakeTransformer) aggregationTreeToPancakes(topLevel pancakeAggregationTree) (pancakeResults []*pancakeModel, err error) { - if topLevel.children == nil || len(topLevel.children) == 0 { + if len(topLevel.children) == 0 { return nil, fmt.Errorf("no top level aggregations found") } diff --git a/quesma/quesma/config/config.go b/quesma/quesma/config/config.go index 755aa82e1..a6bf3d20f 100644 --- a/quesma/quesma/config/config.go +++ b/quesma/quesma/config/config.go @@ -224,7 +224,7 @@ func (c *QuesmaConfiguration) optimizersConfigAsString(s string, cfg map[string] status = "enabled" } lines = append(lines, fmt.Sprintf(" %s: %s", k, status)) - if v.Properties != nil && len(v.Properties) > 0 { + if len(v.Properties) > 0 { lines = append(lines, fmt.Sprintf(" properties: %v", v.Properties)) } } @@ -239,7 +239,7 @@ func (c *QuesmaConfiguration) OptimizersConfigAsString() string { lines = append(lines, "\n") for indexName, indexConfig := range c.IndexConfig { - if indexConfig.Optimizers != nil && len(indexConfig.Optimizers) > 0 { + if len(indexConfig.Optimizers) > 0 { lines = append(lines, c.optimizersConfigAsString(indexName, indexConfig.Optimizers)) } } diff --git a/quesma/quesma/config/config_v2.go b/quesma/quesma/config/config_v2.go index f4ca53383..d50245498 100644 --- a/quesma/quesma/config/config_v2.go +++ b/quesma/quesma/config/config_v2.go @@ -196,7 +196,7 @@ func (c *QuesmaNewConfiguration) validatePipelines() error { } proc := c.getProcessorByName(c.Pipelines[0].Processors[0]) if proc == nil { - return fmt.Errorf(fmt.Sprintf("processor named [%s] not found in configuration", c.Pipelines[0].Processors[0])) + return fmt.Errorf("processor named [%s] not found in configuration", c.Pipelines[0].Processors[0]) } declaredBackendConnectors := c.Pipelines[0].BackendConnectors if proc.Type == QuesmaV1ProcessorNoOp { @@ -214,7 +214,7 @@ func (c *QuesmaNewConfiguration) validatePipelines() error { for _, con := range declaredBackendConnectors { connector := c.getBackendConnectorByName(con) if connector == nil { - return fmt.Errorf(fmt.Sprintf("backend connector named [%s] not found in configuration", con)) + return fmt.Errorf("backend connector named [%s] not found in configuration", con) } backendConnectorTypes = append(backendConnectorTypes, connector.Type) } @@ -234,16 +234,16 @@ func (c *QuesmaNewConfiguration) validatePipelines() error { } } else { - return fmt.Errorf(fmt.Sprintf("frontend connector named [%s] referred in pipeline [%s] not found in configuration", fcName, c.Pipelines[0].Name)) + return fmt.Errorf("frontend connector named [%s] referred in pipeline [%s] not found in configuration", fcName, c.Pipelines[0].Name) } } if isDualPipeline { fc1, fc2 := c.getFrontendConnectorByName(c.Pipelines[0].FrontendConnectors[0]), c.getFrontendConnectorByName(c.Pipelines[1].FrontendConnectors[0]) if fc1 == nil { - return fmt.Errorf(fmt.Sprintf("frontend connector named [%s] not found in configuration", c.Pipelines[0].FrontendConnectors[0])) + return fmt.Errorf("frontend connector named [%s] not found in configuration", c.Pipelines[0].FrontendConnectors[0]) } if fc2 == nil { - return fmt.Errorf(fmt.Sprintf("frontend connector named [%s] not found in configuration", c.Pipelines[1].FrontendConnectors[0])) + return fmt.Errorf("frontend connector named [%s] not found in configuration", c.Pipelines[1].FrontendConnectors[0]) } if !((fc1.Type == ElasticsearchFrontendQueryConnectorName && fc2.Type == ElasticsearchFrontendIngestConnectorName) || (fc2.Type == ElasticsearchFrontendQueryConnectorName && fc1.Type == ElasticsearchFrontendIngestConnectorName)) { @@ -257,7 +257,7 @@ func (c *QuesmaNewConfiguration) validatePipelines() error { } ingestProcessor := c.getProcessorByName(ingestPipeline.Processors[0]) if ingestProcessor == nil { - return fmt.Errorf(fmt.Sprintf("ingest processor named [%s] not found in configuration", ingestPipeline.Processors[0])) + return fmt.Errorf("ingest processor named [%s] not found in configuration", ingestPipeline.Processors[0]) } if ingestProcessor.Type != QuesmaV1ProcessorIngest && ingestProcessor.Type != QuesmaV1ProcessorNoOp { return fmt.Errorf("ingest pipeline must have ingest-type or noop processor") @@ -269,7 +269,7 @@ func (c *QuesmaNewConfiguration) validatePipelines() error { } queryProcessor := c.getProcessorByName(queryPipeline.Processors[0]) if queryProcessor == nil { - return fmt.Errorf(fmt.Sprintf("query processor named [%s] not found in configuration", ingestPipeline.Processors[0])) + return fmt.Errorf("query processor named [%s] not found in configuration", ingestPipeline.Processors[0]) } if (queryProcessor.Type == QuesmaV1ProcessorNoOp && ingestProcessor.Type != QuesmaV1ProcessorNoOp) || (ingestProcessor.Type == QuesmaV1ProcessorNoOp && queryProcessor.Type != QuesmaV1ProcessorNoOp) { @@ -318,7 +318,7 @@ func (c *QuesmaNewConfiguration) validateFrontendConnector(fc FrontendConnector) return fmt.Errorf("frontend connector must have a non-empty name") } if fc.Type != ElasticsearchFrontendIngestConnectorName && fc.Type != ElasticsearchFrontendQueryConnectorName { - return fmt.Errorf(fmt.Sprintf("frontend connector's [%s] type not recognized, only `%s` and `%s` are supported at this moment", fc.Name, ElasticsearchFrontendIngestConnectorName, ElasticsearchFrontendQueryConnectorName)) + return fmt.Errorf("frontend connector's [%s] type not recognized, only `%s` and `%s` are supported at this moment", fc.Name, ElasticsearchFrontendIngestConnectorName, ElasticsearchFrontendQueryConnectorName) } return nil } @@ -390,34 +390,34 @@ func (c *QuesmaNewConfiguration) validatePipeline(pipeline Pipeline) error { return multierror.Append(errAcc, fmt.Errorf("pipeline must have exactly one frontend connector, none defined")) } if !slices.Contains(c.definedFrontedConnectorNames(), pipeline.FrontendConnectors[0]) { - errAcc = multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("frontend connector named %s referenced in %s not found in configuration", pipeline.FrontendConnectors[0], pipeline.Name))) + errAcc = multierror.Append(errAcc, fmt.Errorf("frontend connector named %s referenced in %s not found in configuration", pipeline.FrontendConnectors[0], pipeline.Name)) } if len(pipeline.BackendConnectors) == 0 || len(pipeline.BackendConnectors) > 2 { - return multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("pipeline must define exactly one or two backend connectors, %d defined", len(pipeline.BackendConnectors)))) + return multierror.Append(errAcc, fmt.Errorf("pipeline must define exactly one or two backend connectors, %d defined", len(pipeline.BackendConnectors))) } if !slices.Contains(c.definedBackendConnectorNames(), pipeline.BackendConnectors[0]) { - errAcc = multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("backend connector named %s referenced in %s not found in configuration", pipeline.BackendConnectors[0], pipeline.Name))) + errAcc = multierror.Append(errAcc, fmt.Errorf("backend connector named %s referenced in %s not found in configuration", pipeline.BackendConnectors[0], pipeline.Name)) } if len(pipeline.BackendConnectors) == 2 { if !slices.Contains(c.definedBackendConnectorNames(), pipeline.BackendConnectors[1]) { - errAcc = multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("backend connector named %s referenced in %s not found in configuration", pipeline.BackendConnectors[1], pipeline.Name))) + errAcc = multierror.Append(errAcc, fmt.Errorf("backend connector named %s referenced in %s not found in configuration", pipeline.BackendConnectors[1], pipeline.Name)) } } if len(pipeline.Processors) != 1 { - return multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("pipeline must have exactly one processor, [%s] has %d defined", pipeline.Name, len(pipeline.Processors)))) + return multierror.Append(errAcc, fmt.Errorf("pipeline must have exactly one processor, [%s] has %d defined", pipeline.Name, len(pipeline.Processors))) } if !slices.Contains(c.definedProcessorNames(), pipeline.Processors[0]) { - errAcc = multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("processor named %s referenced in %s not found in configuration", pipeline.Processors[0], pipeline.Name))) + errAcc = multierror.Append(errAcc, fmt.Errorf("processor named %s referenced in %s not found in configuration", pipeline.Processors[0], pipeline.Name)) } else { onlyProcessorInPipeline := c.getProcessorByName(pipeline.Processors[0]) if onlyProcessorInPipeline.Type == QuesmaV1ProcessorNoOp { if len(pipeline.BackendConnectors) != 1 { - return multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("pipeline %s has a noop processor supports only one backend connector", pipeline.Name))) + return multierror.Append(errAcc, fmt.Errorf("pipeline %s has a noop processor supports only one backend connector", pipeline.Name)) } if conn := c.getBackendConnectorByName(pipeline.BackendConnectors[0]); conn.Type != ElasticsearchBackendConnectorName { - return multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("pipeline %s has a noop processor which can be connected only to elasticsearch backend connector", pipeline.Name))) + return multierror.Append(errAcc, fmt.Errorf("pipeline %s has a noop processor which can be connected only to elasticsearch backend connector", pipeline.Name)) } } if onlyProcessorInPipeline.Type == QuesmaV1ProcessorQuery || onlyProcessorInPipeline.Type == QuesmaV1ProcessorIngest { @@ -425,14 +425,14 @@ func (c *QuesmaNewConfiguration) validatePipeline(pipeline Pipeline) error { for _, backendConnectorName := range pipeline.BackendConnectors { backendConnector := c.getBackendConnectorByName(backendConnectorName) if backendConnector == nil { - return multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("backend connector named %s referenced in %s not found in configuration", backendConnectorName, pipeline.Name))) + return multierror.Append(errAcc, fmt.Errorf("backend connector named %s referenced in %s not found in configuration", backendConnectorName, pipeline.Name)) } if backendConnector.Type == ElasticsearchBackendConnectorName { foundElasticBackendConnector = true } } if !foundElasticBackendConnector { - return multierror.Append(errAcc, fmt.Errorf(fmt.Sprintf("pipeline %s has a processor of type %s which requires having one elasticsearch backend connector", pipeline.Name, onlyProcessorInPipeline.Type))) + return multierror.Append(errAcc, fmt.Errorf("pipeline %s has a processor of type %s which requires having one elasticsearch backend connector", pipeline.Name, onlyProcessorInPipeline.Type)) } } } diff --git a/quesma/quesma/functionality/terms_enum/terms_enum.go b/quesma/quesma/functionality/terms_enum/terms_enum.go index a9198fc48..f92ff8987 100644 --- a/quesma/quesma/functionality/terms_enum/terms_enum.go +++ b/quesma/quesma/functionality/terms_enum/terms_enum.go @@ -5,6 +5,7 @@ package terms_enum import ( "context" "encoding/json" + "errors" "fmt" "quesma/clickhouse" "quesma/end_user_errors" @@ -24,7 +25,7 @@ func HandleTermsEnum(ctx context.Context, index string, body types.JSON, lm *cli if indices, err := lm.ResolveIndexPattern(ctx, index); err != nil || len(indices) != 1 { // multi index terms enum is not yet supported errorMsg := fmt.Sprintf("terms enum failed - could not resolve table name for index: %s", index) logger.Error().Msg(errorMsg) - return nil, fmt.Errorf(errorMsg) + return nil, errors.New(errorMsg) } else { resolvedTableName := indices[0] resolvedSchema, ok := schemaRegistry.FindSchema(schema.TableName(resolvedTableName)) diff --git a/smoke-test/go.mod b/smoke-test/go.mod index c86957094..fa569f5f7 100644 --- a/smoke-test/go.mod +++ b/smoke-test/go.mod @@ -1,6 +1,6 @@ module mitmproxy/quesma -go 1.22.5 +go 1.23.2 require ( github.com/mailru/go-clickhouse/v2 v2.3.0