Skip to content

Commit

Permalink
zapslog: Delete x/exp-based implementation (#1338)
Browse files Browse the repository at this point in the history
Deletes the implementation of slog.Handler based on
golang.org/x/exp/slog.
Maintaining two implementations doesn't serve much value here.

Remaining files have been renamed to better match their contents:

- handler.go holds the slog.Handler
- handler_test.go tests that
- example_test.go contains example tests

Files that remain are still tagged with `go1.21`
so they're only visible to Go 1.21 or newer.

This way, `go test` in this directory with Go 1.20 will not fail:

```
% GOTOOLCHAIN=go1.20 go test -v
?       go.uber.org/zap/exp/zapslog     [no test files]
```

Resolves #1337
  • Loading branch information
abhinav committed Aug 23, 2023
1 parent fd37f1f commit 55a2367
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 325 deletions.
1 change: 0 additions & 1 deletion exp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.19
require (
github.com/stretchr/testify v1.8.1
go.uber.org/zap v1.24.0
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb
)

require (
Expand Down
2 changes: 0 additions & 2 deletions exp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
3 changes: 1 addition & 2 deletions exp/zapslog/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@
// Package zapslog provides an implementation of slog.Handler which writes to
// the supplied zapcore.Core.
//
// For versions of Go before 1.21, this package uses golang.org/x/exp/slog.
// For Go 1.21 or newer, this package uses the standard log/slog package.
// Use of this package requires at least Go 1.21.
package zapslog // import "go.uber.org/zap/exp/zapslog"
79 changes: 0 additions & 79 deletions exp/zapslog/example_pre_go121_test.go

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestAddSource(t *testing.T) {
entry := logs.AllUntimed()[0]
assert.Equal(t, "msg", entry.Message, "Unexpected message")
assert.Regexp(t,
`/slog_go121_test.go:\d+$`,
`/handler_test.go:\d+$`,
entry.Caller.String(),
"Unexpected caller annotation.",
)
Expand Down
190 changes: 0 additions & 190 deletions exp/zapslog/slog_pre_go121.go

This file was deleted.

50 changes: 0 additions & 50 deletions exp/zapslog/slog_pre_go121_test.go

This file was deleted.

0 comments on commit 55a2367

Please sign in to comment.