Chore: Bump Go to 1.23.0 (#92105)

* chore: Bump Go to 1.23.0

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* update swagger files

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* chore: update .bingo/README.md formatting to satisfy prettier

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* chore(lint): Fix new lint errors found by golangci-lint 1.60.1 and Go 1.23

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* keep golden file

* update openapi

* add name to expected output

* chore(lint): rearrange imports to a sensible order

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Dave Henderson
2024-08-21 11:40:42 -04:00
committed by GitHub
co-authored by Ryan McKinley
parent 02c820382d
commit df3d8915ba
63 changed files with 289 additions and 627 deletions
+3 -3
View File
@@ -17,10 +17,10 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource"
"golang.org/x/sync/errgroup"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/features"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models"
"golang.org/x/sync/errgroup"
)
const (
@@ -209,7 +209,7 @@ func (e *cloudWatchExecutor) executeStartQuery(ctx context.Context, logsClient c
QueryString: aws.String(modifiedQueryString),
}
if logsQuery.LogGroups != nil && len(logsQuery.LogGroups) > 0 && features.IsEnabled(ctx, features.FlagCloudWatchCrossAccountQuerying) {
if len(logsQuery.LogGroups) > 0 && features.IsEnabled(ctx, features.FlagCloudWatchCrossAccountQuerying) {
var logGroupIdentifiers []string
for _, lg := range logsQuery.LogGroups {
arn := lg.Arn
+1 -1
View File
@@ -26,7 +26,7 @@ type CloudWatchSettings struct {
func LoadCloudWatchSettings(ctx context.Context, config backend.DataSourceInstanceSettings) (CloudWatchSettings, error) {
instance := CloudWatchSettings{}
if config.JSONData != nil && len(config.JSONData) > 1 {
if len(config.JSONData) > 1 {
if err := json.Unmarshal(config.JSONData, &instance); err != nil {
return CloudWatchSettings{}, fmt.Errorf("could not unmarshal DatasourceSettings json: %w", err)
}
@@ -15,11 +15,10 @@ import (
"time"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
"github.com/grafana/grafana-plugin-sdk-go/backend/gtime"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
)
// MetaKeyExecutedQueryString is the key where the executed query should get stored
@@ -214,7 +213,7 @@ func (e *DataSourceHandler) executeQuery(query backend.DataQuery, wg *sync.WaitG
if theErr, ok := r.(error); ok {
queryResult.dataResponse.Error = theErr
} else if theErrString, ok := r.(string); ok {
queryResult.dataResponse.Error = fmt.Errorf(theErrString)
queryResult.dataResponse.Error = errors.New(theErrString)
} else {
queryResult.dataResponse.Error = fmt.Errorf("unexpected error - %s", e.userError)
}
@@ -35,7 +35,7 @@ type SimulationEngine struct {
func (s *SimulationEngine) register(info simulationInfo) error {
if info.create == nil {
return fmt.Errorf("invalid simulation -- missing create function: " + info.Type)
return fmt.Errorf("invalid simulation -- missing create function: %s", info.Type)
}
if info.Type == "" {
return fmt.Errorf("missing type")
+3 -3
View File
@@ -41,13 +41,13 @@ func executeQuery(ctx context.Context, logger log.Logger, query queryModel, runn
// the error happens, there is not enough info to create a nice error message)
var maxPointError maxPointsExceededError
if errors.As(dr.Error, &maxPointError) {
text := fmt.Sprintf("A query returned too many datapoints and the results have been truncated at %d points to prevent memory issues. At the current graph size, Grafana can only draw %d.", maxPointError.Count, query.MaxDataPoints)
errMsg := "A query returned too many datapoints and the results have been truncated at %d points to prevent memory issues. At the current graph size, Grafana can only draw %d."
// we recommend to the user to use AggregateWindow(), but only if it is not already used
if !strings.Contains(query.RawQuery, "aggregateWindow(") {
text += " Try using the aggregateWindow() function in your query to reduce the number of points returned."
errMsg += " Try using the aggregateWindow() function in your query to reduce the number of points returned."
}
dr.Error = fmt.Errorf(text)
dr.Error = fmt.Errorf(errMsg, maxPointError.Count, query.MaxDataPoints)
}
}
}
+1 -1
View File
@@ -315,7 +315,7 @@ func TestNewFrame(t *testing.T) {
},
}
if !cmp.Equal(expected, actual, cmp.Comparer(cmpFrame)) {
log.Fatalf(cmp.Diff(expected, actual))
log.Fatal(cmp.Diff(expected, actual))
}
}
@@ -1,6 +1,7 @@
package buffered
import (
"errors"
"fmt"
"io"
"strings"
@@ -36,12 +37,12 @@ func parse(buf io.Reader, statusCode int, query *models.Query) *backend.DataResp
}
if response.Error != "" {
return &backend.DataResponse{Error: fmt.Errorf(response.Error)}
return &backend.DataResponse{Error: errors.New(response.Error)}
}
result := response.Results[0]
if result.Error != "" {
return &backend.DataResponse{Error: fmt.Errorf(result.Error)}
return &backend.DataResponse{Error: errors.New(result.Error)}
}
if query.ResultFormat == "table" {
@@ -1,6 +1,7 @@
package converter
import (
"errors"
"fmt"
"strconv"
"strings"
@@ -39,7 +40,7 @@ l1Fields:
if err != nil {
rsp.Error = err
} else {
rsp.Error = fmt.Errorf(v)
rsp.Error = errors.New(v)
}
return rsp
case "code":
@@ -55,12 +56,10 @@ l1Fields:
}
return rspErr(fmt.Errorf("%s", v))
case "":
if err != nil {
return rspErr(err)
}
break l1Fields
default:
v, err := iter.Read()
// TODO: log this properly
fmt.Printf("[ROOT] unsupported key: %s / %v\n\n", l1Field, v)
if err != nil {
if rsp != nil {
+1 -1
View File
@@ -194,7 +194,7 @@ func execute(ctx context.Context, tracer trace.Tracer, dsInfo *models.Datasource
resp = buffered.ResponseParse(res.Body, res.StatusCode, query)
}
if resp.Frames != nil && len(resp.Frames) > 0 {
if len(resp.Frames) > 0 {
resp.Frames[0].Meta.Custom = readCustomMetadata(res)
}
+3 -4
View File
@@ -15,11 +15,10 @@ import (
"time"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
"github.com/grafana/grafana-plugin-sdk-go/backend/gtime"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
)
// MetaKeyExecutedQueryString is the key where the executed query should get stored
@@ -214,7 +213,7 @@ func (e *DataSourceHandler) executeQuery(query backend.DataQuery, wg *sync.WaitG
if theErr, ok := r.(error); ok {
queryResult.dataResponse.Error = theErr
} else if theErrString, ok := r.(string); ok {
queryResult.dataResponse.Error = fmt.Errorf(theErrString)
queryResult.dataResponse.Error = errors.New(theErrString)
} else {
queryResult.dataResponse.Error = fmt.Errorf("unexpected error - %s", e.userError)
}
+3 -4
View File
@@ -16,11 +16,10 @@ import (
"github.com/go-sql-driver/mysql"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
"github.com/grafana/grafana-plugin-sdk-go/backend/gtime"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
)
// MetaKeyExecutedQueryString is the key where the executed query should get stored
@@ -224,7 +223,7 @@ func (e *DataSourceHandler) executeQuery(query backend.DataQuery, wg *sync.WaitG
if theErr, ok := r.(error); ok {
queryResult.dataResponse.Error = theErr
} else if theErrString, ok := r.(string); ok {
queryResult.dataResponse.Error = fmt.Errorf(theErrString)
queryResult.dataResponse.Error = errors.New(theErrString)
} else {
queryResult.dataResponse.Error = fmt.Errorf("unexpected error - %s", e.userError)
}