Skip to content

Commit

Permalink
chore: bump to go1.21 (#747)
Browse files Browse the repository at this point in the history
# Description

bump to go1.21 and replace `golang.org/x/exp/slog` with `log/slog`

Close #745, #746
  • Loading branch information
woorui committed Mar 12, 2024
1 parent 61a52d6 commit 0dfc544
Show file tree
Hide file tree
Showing 30 changed files with 369 additions and 301 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
run: go build $(go list ./... | grep -v /example)

- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
done
- name: Upload
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Expand Down
2 changes: 1 addition & 1 deletion core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log/slog"
"runtime"
"time"

Expand All @@ -15,7 +16,6 @@ import (
"github.com/yomorun/yomo/pkg/frame-codec/y3codec"
"github.com/yomorun/yomo/pkg/id"
yquic "github.com/yomorun/yomo/pkg/listener/quic"
"golang.org/x/exp/slog"
)

// Client is the abstraction of a YoMo-Client. a YoMo-Client can be
Expand Down
2 changes: 1 addition & 1 deletion core/client_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"fmt"
"log"
"log/slog"
"os"
"strings"
"time"
Expand All @@ -16,7 +17,6 @@ import (
"github.com/yomorun/yomo/core/frame"
"github.com/yomorun/yomo/core/ylog"
pkgtls "github.com/yomorun/yomo/pkg/tls"
"golang.org/x/exp/slog"
)

// ClientOption YoMo client options
Expand Down
2 changes: 1 addition & 1 deletion core/connection.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package core

import (
"log/slog"
"sync/atomic"

"github.com/yomorun/yomo/core/frame"
"github.com/yomorun/yomo/core/metadata"
"golang.org/x/exp/slog"
)

var increment uint64
Expand Down
2 changes: 1 addition & 1 deletion core/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package core

import (
"context"
"log/slog"
"sync"
"time"

"github.com/yomorun/yomo/core/frame"
"github.com/yomorun/yomo/core/metadata"
"golang.org/x/exp/slog"
)

var ctxPool sync.Pool
Expand Down
2 changes: 1 addition & 1 deletion core/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"net"
"os"
"sync"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/yomorun/yomo/core/frame"
"github.com/yomorun/yomo/core/metadata"
"github.com/yomorun/yomo/core/router"
"golang.org/x/exp/slog"

// authentication implements, Currently, only token authentication is implemented
_ "github.com/yomorun/yomo/pkg/auth"
Expand Down
2 changes: 1 addition & 1 deletion core/server_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package core

import (
"crypto/tls"
"log/slog"
"time"

"github.com/quic-go/quic-go"
"github.com/yomorun/yomo/core/auth"
"github.com/yomorun/yomo/core/ylog"
"golang.org/x/exp/slog"
)

// DefaultQuicConfig be used when `quicConfig` is nil.
Expand Down
2 changes: 1 addition & 1 deletion core/ylog/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ package ylog
import (
"io"
"log"
"log/slog"
"os"
"strings"

"github.com/caarlos0/env/v6"
"golang.org/x/exp/slog"
"gopkg.in/natefinch/lumberjack.v2"
)

Expand Down
2 changes: 1 addition & 1 deletion core/ylog/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package ylog

import (
"io"
"log/slog"
"os"
"path"
"testing"

"github.com/stretchr/testify/assert"
"golang.org/x/exp/slog"
)

func TestLogger(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions core/ylog/slog_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"bytes"
"context"
"io"
"log/slog"
"os"
"strings"
"sync"

"golang.org/x/exp/slog"
)

// handler supports splitting log stream to common log stream and error log stream.
Expand Down
2 changes: 1 addition & 1 deletion example/0-basic/sfn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package main

import (
"encoding/json"
"log/slog"
"os"

"github.com/yomorun/yomo"
"github.com/yomorun/yomo/serverless"
"golang.org/x/exp/slog"
)

type noiseData struct {
Expand Down
2 changes: 1 addition & 1 deletion example/0-basic/source/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package main

import (
"encoding/json"
"log/slog"
"math/rand"
"os"
"time"

"github.com/yomorun/yomo"
"golang.org/x/exp/slog"
)

// custom logger
Expand Down
49 changes: 27 additions & 22 deletions example/1-pipeline/go.mod
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
module yomo.run/example-pipe

go 1.20
go 1.21.0

replace github.com/yomorun/yomo => ../../

require github.com/yomorun/yomo v0.0.0

require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/caarlos0/env/v6 v6.10.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/invopop/jsonschema v0.12.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matoous/go-nanoid/v2 v2.0.0 // indirect
github.com/onsi/ginkgo/v2 v2.13.1 // indirect
github.com/quic-go/qtls-go1-20 v0.4.1 // indirect
github.com/quic-go/quic-go v0.40.1 // indirect
github.com/quic-go/quic-go v0.41.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/yomorun/y3 v1.0.5 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/mock v0.3.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

0 comments on commit 0dfc544

Please sign in to comment.