Skip to content

Commit 50965fd

Browse files
authored
Use Go 1.19 / Remove deprecated API usage (uber-go#352)
Go 1.19 is out. Let's use it in the CI. Also, this updates staticcheck version and removes deprecated API usage.
1 parent 7398ffb commit 50965fd

File tree

15 files changed

+265
-258
lines changed

15 files changed

+265
-258
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
go: ["1.17.x", "1.18.x"]
16+
go: ["1.17.x", "1.18.x", "1.19.x"]
1717
include:
18-
- go: 1.18.x
18+
- go: 1.19.x
1919
latest: true
2020

2121
steps:

decorate.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -177,29 +177,32 @@ func (c *Container) Decorate(decorator interface{}, opts ...DecorateOption) erro
177177
// Scope, or completely replace it with a new object.
178178
//
179179
// For example,
180-
// s.Decorate(func(log *zap.Logger) *zap.Logger {
181-
// return log.Named("myapp")
182-
// })
180+
//
181+
// s.Decorate(func(log *zap.Logger) *zap.Logger {
182+
// return log.Named("myapp")
183+
// })
183184
//
184185
// This takes in a value, augments it with a name, and returns a replacement for it. Functions
185186
// in the Scope's dependency graph that use *zap.Logger will now use the *zap.Logger
186187
// returned by this decorator.
187188
//
188189
// A decorator can also take in multiple parameters and replace one of them:
189-
// s.Decorate(func(log *zap.Logger, cfg *Config) *zap.Logger {
190-
// return log.Named(cfg.Name)
191-
// })
190+
//
191+
// s.Decorate(func(log *zap.Logger, cfg *Config) *zap.Logger {
192+
// return log.Named(cfg.Name)
193+
// })
192194
//
193195
// Or replace a subset of them:
194-
// s.Decorate(func(
195-
// log *zap.Logger,
196-
// cfg *Config,
197-
// scope metrics.Scope
198-
// ) (*zap.Logger, metrics.Scope) {
199-
// log = log.Named(cfg.Name)
200-
// scope = scope.With(metrics.Tag("service", cfg.Name))
201-
// return log, scope
202-
// })
196+
//
197+
// s.Decorate(func(
198+
// log *zap.Logger,
199+
// cfg *Config,
200+
// scope metrics.Scope
201+
// ) (*zap.Logger, metrics.Scope) {
202+
// log = log.Named(cfg.Name)
203+
// scope = scope.With(metrics.Tag("service", cfg.Name))
204+
// return log, scope
205+
// })
203206
//
204207
// Decorating a Scope affects all the child scopes of this Scope.
205208
//

dig_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"errors"
2626
"fmt"
2727
"io"
28-
"io/ioutil"
2928
"math/rand"
3029
"os"
3130
"reflect"
@@ -165,7 +164,7 @@ func TestEndToEndSuccess(t *testing.T) {
165164
c.RequireProvide(func() contents { return "hello world" })
166165

167166
c.RequireInvoke(func(buff *bytes.Buffer) {
168-
out, err := ioutil.ReadAll(buff)
167+
out, err := io.ReadAll(buff)
169168
require.NoError(t, err, "read from buffer failed")
170169
require.Equal(t, "hello world", string(out), "contents don't match")
171170
})
@@ -656,7 +655,7 @@ func TestEndToEndSuccess(t *testing.T) {
656655
c.RequireInvoke(
657656
func(s fmt.Stringer, r io.Reader) {
658657
require.Equal(t, "foo", s.String(), "invoke got new buffer")
659-
got, err := ioutil.ReadAll(r)
658+
got, err := io.ReadAll(r)
660659
assert.NoError(t, err, "failed to read from reader")
661660
require.Equal(t, "foo", string(got), "invoke got new buffer")
662661
})

0 commit comments

Comments
 (0)