Skip to content

Commit

Permalink
Slog upgrade with Go 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
mantzas committed Nov 6, 2023
1 parent aa8ce66 commit 4c184d3
Show file tree
Hide file tree
Showing 36 changed files with 39 additions and 42 deletions.
2 changes: 1 addition & 1 deletion client/amqp/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"strconv"
"time"

Expand All @@ -16,7 +17,6 @@ import (
"github.com/opentracing/opentracing-go/ext"
"github.com/prometheus/client_golang/prometheus"
"github.com/streadway/amqp"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/es/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
"log/slog"
"net/http"
"net/url"
"os"
Expand All @@ -20,7 +21,6 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package grpc

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

"github.com/beatlabs/patron/correlation"
Expand All @@ -11,7 +12,6 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
Expand Down
2 changes: 1 addition & 1 deletion client/http/encoding/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"errors"
"fmt"
"io"
"log/slog"
"net/http"
"strconv"

"github.com/beatlabs/patron/encoding"
"github.com/beatlabs/patron/encoding/json"
"github.com/beatlabs/patron/log"
"golang.org/x/exp/slog"
)

// NewRequest creates a request, encodes the body, and sets the appropriate headers.
Expand Down
2 changes: 1 addition & 1 deletion client/mqtt/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"net/url"
"strconv"
"time"
Expand All @@ -16,7 +17,6 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
)

const componentType = "mqtt-publisher"
Expand Down
2 changes: 1 addition & 1 deletion client/sns/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"strconv"
"time"

Expand All @@ -17,7 +18,6 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/sns/publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"os"
"testing"

Expand All @@ -15,7 +16,6 @@ import (
"github.com/opentracing/opentracing-go/mocktracer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
)

func Test_New(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/sqs/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"strconv"
"time"

Expand All @@ -18,7 +19,6 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/sqs/publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"os"
"testing"

Expand All @@ -16,7 +17,6 @@ import (
"github.com/opentracing/opentracing-go/mocktracer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
)

func Test_New(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion component/amqp/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"net"
"time"

Expand All @@ -16,7 +17,6 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/streadway/amqp"
"golang.org/x/exp/slog"
)

type messageState string
Expand Down
2 changes: 1 addition & 1 deletion component/async/amqp/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"net"
"time"

Expand All @@ -22,7 +23,6 @@ import (
"github.com/google/uuid"
"github.com/opentracing/opentracing-go"
"github.com/streadway/amqp"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion component/async/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"time"

patronErrors "github.com/beatlabs/patron/errors"
"github.com/beatlabs/patron/log"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
)

var consumerErrors *prometheus.CounterVec
Expand Down
2 changes: 1 addition & 1 deletion component/async/kafka/group/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"strings"

"github.com/Shopify/sarama"
"github.com/beatlabs/patron/component/async"
"github.com/beatlabs/patron/component/async/kafka"
"github.com/beatlabs/patron/internal/validation"
opentracing "github.com/opentracing/opentracing-go"
"golang.org/x/exp/slog"
)

// Factory definition of a consumer factory.
Expand Down
2 changes: 1 addition & 1 deletion component/async/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"strconv"
"time"

Expand All @@ -17,7 +18,6 @@ import (
"github.com/google/uuid"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion component/async/kafka/simple/duration_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"time"

"github.com/beatlabs/patron/log"
"golang.org/x/exp/slog"
)

type durationClient struct {
Expand Down
2 changes: 1 addition & 1 deletion component/async/kafka/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"sync"
"time"

"github.com/Shopify/sarama"
"github.com/beatlabs/patron/component/async"
"github.com/beatlabs/patron/component/async/kafka"
"github.com/beatlabs/patron/internal/validation"
"golang.org/x/exp/slog"
)

// unixNanoToTimestampDivider divides unix nano seconds to valid timestamp for kafka messages.
Expand Down
2 changes: 1 addition & 1 deletion component/grpc/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package grpc
import (
"context"
"fmt"
"log/slog"
"net"

"golang.org/x/exp/slog"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
Expand Down
2 changes: 1 addition & 1 deletion component/grpc/observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package grpc

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

Expand All @@ -11,7 +12,6 @@ import (
"github.com/google/uuid"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
Expand Down
2 changes: 1 addition & 1 deletion component/http/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"context"
"fmt"
"hash/crc32"
"log/slog"
"net/http"
"strconv"
"strings"
"time"

"github.com/beatlabs/patron/cache"
"golang.org/x/exp/slog"
)

type validationContext int
Expand Down
2 changes: 1 addition & 1 deletion component/http/cache/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"bytes"
"errors"
"fmt"
"log/slog"
"net/http"
"time"

"github.com/beatlabs/patron/cache"
"golang.org/x/exp/slog"
)

// RouteCache is the builder needed to build a cache for the corresponding route.
Expand Down
2 changes: 1 addition & 1 deletion component/http/check.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package http

import (
"log/slog"
"net/http"

"github.com/beatlabs/patron/log"
"golang.org/x/exp/slog"
)

// AliveStatus type representing the liveness of the service via HTTP component.
Expand Down
3 changes: 1 addition & 2 deletions component/http/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"net/http"
"os"
"strconv"
"sync"
"time"

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

const (
Expand Down
2 changes: 1 addition & 1 deletion component/http/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"log/slog"
"math"
"net/http"
"net/url"
Expand All @@ -27,7 +28,6 @@ import (
"github.com/opentracing/opentracing-go/ext"
tracinglog "github.com/opentracing/opentracing-go/log"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
"golang.org/x/time/rate"
)

Expand Down
2 changes: 1 addition & 1 deletion component/http/router/httprouter/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package httprouter

import (
"fmt"
"log/slog"
"os"

patronhttp "github.com/beatlabs/patron/component/http"
"github.com/beatlabs/patron/component/http/middleware"
"github.com/julienschmidt/httprouter"
"golang.org/x/exp/slog"
)

const defaultDeflateLevel = 6
Expand Down
2 changes: 1 addition & 1 deletion component/kafka/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"strconv"
"sync"
"time"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/google/uuid"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion component/kafka/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package kafka
import (
"errors"
"fmt"
"log/slog"
"time"

"github.com/Shopify/sarama"
"golang.org/x/exp/slog"
)

// OptionFunc definition for configuring the component in a functional way.
Expand Down
Loading

0 comments on commit 4c184d3

Please sign in to comment.