Skip to content

Commit e6f9dfc

Browse files
authored
Merge pull request #162 from scribd/maksimt/DEVPLAT-6703/bump-go
[DEVPLAT-6703] Bump go version to v1.26.2
2 parents 5f91c8f + e57c7dd commit e6f9dfc

43 files changed

Lines changed: 188 additions & 197 deletions

Some content is hidden

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

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# build stage
33
# =============================================================================
44

5-
FROM golang:1.25.5-alpine AS builder
5+
FROM golang:1.26.2-alpine AS builder
66

77
WORKDIR /sdk
88

@@ -33,15 +33,15 @@ FROM builder AS linter
3333

3434
# binary will be $(go env GOPATH)/bin/golangci-lint
3535
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
36-
| sh -s -- -b $(go env GOPATH)/bin v2.4.0
36+
| sh -s -- -b $(go env GOPATH)/bin v2.11.4
3737

3838
# install goimports
39-
RUN go install golang.org/x/tools/cmd/goimports@v0.36.0
39+
RUN go install golang.org/x/tools/cmd/goimports@v0.44.0
4040

4141
# =============================================================================
4242
# development stage
4343
# =============================================================================
4444

4545
FROM linter AS development
4646

47-
RUN go install github.com/go-delve/delve/cmd/dlv@v1.25.1
47+
RUN go install github.com/go-delve/delve/cmd/dlv@v1.26.2

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ SDK, the Go version.
6767

6868
## Prerequisites
6969

70-
* [Go](https://golang.org) (version `1.25.0`).
70+
* [Go](https://golang.org) (version `1.26.2`).
7171
* [Docker](https://www.docker.com/) (version `19.03.2`).
7272

7373
## SDK functionality
@@ -1743,7 +1743,7 @@ You can enter the docker environment to build, run and debug your service:
17431743
```
17441744
$ docker-compose run --rm sdk /bin/bash
17451745
root@1f31fa8e5c49:/sdk# go version
1746-
go version go1.25.0 linux/amd64
1746+
go version go1.26.2 linux/amd64
17471747
```
17481748

17491749
Refer to the

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/scribd/go-sdk
22

3-
go 1.25.5
3+
go 1.26.2
44

55
require (
66
github.com/DATA-DOG/go-sqlmock v1.5.2

internal/pkg/configuration/builder/viper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// ViperBuilder is a builder to streamline Viper configuration and building.
1414
type ViperBuilder struct {
1515
vConf *viper.Viper
16-
defaults map[string]interface{}
16+
defaults map[string]any
1717
name string
1818
}
1919

@@ -32,7 +32,7 @@ func New(name string) *ViperBuilder {
3232
return &ViperBuilder{
3333
vConf: vConf,
3434
name: name,
35-
defaults: make(map[string]interface{}),
35+
defaults: make(map[string]any),
3636
}
3737
}
3838

@@ -45,7 +45,7 @@ func (vb *ViperBuilder) ConfigPath(path string) *ViperBuilder {
4545
// SetDefault sets a default value for a configuration key.
4646
// Any default value set will be available in the `viper.Viper` configuration
4747
// instance that is returned after calling the `Build()` function.
48-
func (vb *ViperBuilder) SetDefault(key string, value interface{}) *ViperBuilder {
48+
func (vb *ViperBuilder) SetDefault(key string, value any) *ViperBuilder {
4949
vb.defaults[key] = value
5050
return vb
5151
}

pkg/app/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (c *Config) String(key string) string {
5858
}
5959

6060
// StringMap returns a key's value as map[string]interface{}.
61-
func (c *Config) StringMap(key string) map[string]interface{} {
61+
func (c *Config) StringMap(key string) map[string]any {
6262
return c.vConf.GetStringMap(key)
6363
}
6464

@@ -83,7 +83,7 @@ func (c *Config) Duration(key string) time.Duration {
8383
}
8484

8585
// Set sets a value to a key.
86-
func (c *Config) Set(key string, value interface{}) {
86+
func (c *Config) Set(key string, value any) {
8787
c.vConf.Set(key, value)
8888
}
8989

@@ -93,6 +93,6 @@ func (c *Config) IsSet(key string) bool {
9393
}
9494

9595
// AllSettings returns all settings as map.
96-
func (c *Config) AllSettings() map[string]interface{} {
96+
func (c *Config) AllSettings() map[string]any {
9797
return c.vConf.AllSettings()
9898
}

pkg/aws/aws_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ func TestBuilder(t *testing.T) {
282282
}
283283

284284
for _, tc := range tests {
285-
tc := tc
286285
t.Run(tc.name, func(t *testing.T) {
287286
tc.fn(t)
288287
})

pkg/context/logger/context.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package logger
33
import (
44
"context"
55
"fmt"
6+
"maps"
67

78
grpcctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
89

@@ -26,9 +27,7 @@ func AddFields(ctx context.Context, fields sdklogger.Fields) {
2627
if !ok || l == nil {
2728
return
2829
}
29-
for k, v := range fields {
30-
l.fields[k] = v
31-
}
30+
maps.Copy(l.fields, fields)
3231
}
3332

3433
// Extract takes the call-scoped sdklogger.Logger from the context.
@@ -43,14 +42,10 @@ func Extract(ctx context.Context) (sdklogger.Logger, error) {
4342

4443
// Add grpcctxtags tags metadata until now.
4544
tags := grpcctxtags.Extract(ctx)
46-
for k, v := range tags.Values() {
47-
fields[k] = v
48-
}
45+
maps.Copy(fields, tags.Values())
4946

5047
// Add sdklogger fields added until now.
51-
for k, v := range l.fields {
52-
fields[k] = v
53-
}
48+
maps.Copy(fields, l.fields)
5449

5550
return l.logger.WithFields(fields), nil
5651
}

pkg/instrumentation/kafka/kafka_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func TestNewClient(t *testing.T) {
130130
assert.Len(t, spans, 7)
131131

132132
// produce
133-
for i := 0; i < 4; i++ {
133+
for i := range 4 {
134134
s := spans[i]
135135
assert.Equal(t, "kafka.produce", s.OperationName())
136136
assert.Equal(t, "kafka", s.Tag(ext.ServiceName))

pkg/interceptors/database.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
func DatabaseUnaryServerInterceptor(db *gorm.DB) grpc.UnaryServerInterceptor {
1515
return func(
1616
ctx context.Context,
17-
req interface{},
17+
req any,
1818
info *grpc.UnaryServerInfo,
1919
handler grpc.UnaryHandler,
20-
) (interface{}, error) {
20+
) (any, error) {
2121
instrumentedDB := db.WithContext(ctx)
2222
newCtx := sdkcontext.ToContext(ctx, instrumentedDB)
2323

@@ -28,7 +28,7 @@ func DatabaseUnaryServerInterceptor(db *gorm.DB) grpc.UnaryServerInterceptor {
2828
// DatabaseStreamServerInterceptor returns a streaming server interceptor that adds gorm.DB to the context.
2929
func DatabaseStreamServerInterceptor(db *gorm.DB) grpc.StreamServerInterceptor {
3030
return func(
31-
srv interface{},
31+
srv any,
3232
stream grpc.ServerStream,
3333
info *grpc.StreamServerInfo,
3434
handler grpc.StreamHandler,

pkg/interceptors/database_logging.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import (
1919
func DatabaseLoggingUnaryServerInterceptor() grpc.UnaryServerInterceptor {
2020
return func(
2121
ctx context.Context,
22-
req interface{},
22+
req any,
2323
_ *grpc.UnaryServerInfo,
2424
handler grpc.UnaryHandler,
25-
) (interface{}, error) {
25+
) (any, error) {
2626
db, err := sdkdatabasecontext.Extract(ctx)
2727
if err != nil {
2828
return nil, err
@@ -50,7 +50,7 @@ func DatabaseLoggingUnaryServerInterceptor() grpc.UnaryServerInterceptor {
5050
// meta-information using the logger.
5151
func DatabaseLoggingStreamServerInterceptor() grpc.StreamServerInterceptor {
5252
return func(
53-
srv interface{},
53+
srv any,
5454
stream grpc.ServerStream,
5555
_ *grpc.StreamServerInfo,
5656
handler grpc.StreamHandler,

0 commit comments

Comments
 (0)