mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-16 02:47:03 +02:00
fix: fmt import (#2379)
This commit is contained in:
parent
8d067a32db
commit
4d95050747
@ -9,7 +9,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -18,6 +17,8 @@ import (
|
|||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
dpb "google.golang.org/protobuf/types/descriptorpb"
|
dpb "google.golang.org/protobuf/types/descriptorpb"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is api meta server
|
// Server is api meta server
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/AlecAivazis/survey/v2"
|
"github.com/AlecAivazis/survey/v2"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
|
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/AlecAivazis/survey/v2"
|
"github.com/AlecAivazis/survey/v2"
|
||||||
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdNew represents the new command.
|
// CmdNew represents the new command.
|
||||||
|
@ -8,9 +8,10 @@ import (
|
|||||||
"golang.org/x/text/cases"
|
"golang.org/x/text/cases"
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2/errors"
|
|
||||||
"google.golang.org/protobuf/compiler/protogen"
|
"google.golang.org/protobuf/compiler/protogen"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/apolloconfig/agollo/v4/constant"
|
"github.com/apolloconfig/agollo/v4/constant"
|
||||||
apolloConfig "github.com/apolloconfig/agollo/v4/env/config"
|
apolloConfig "github.com/apolloconfig/agollo/v4/env/config"
|
||||||
"github.com/apolloconfig/agollo/v4/extension"
|
"github.com/apolloconfig/agollo/v4/extension"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/encoding"
|
"github.com/go-kratos/kratos/v2/encoding"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
"github.com/hashicorp/consul/api"
|
"github.com/hashicorp/consul/api"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Option is etcd config option.
|
// Option is etcd config option.
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
"github.com/hashicorp/consul/api"
|
"github.com/hashicorp/consul/api"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
const testPath = "kratos/test/config"
|
const testPath = "kratos/test/config"
|
||||||
|
@ -3,9 +3,10 @@ package consul
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
"github.com/hashicorp/consul/api"
|
"github.com/hashicorp/consul/api"
|
||||||
"github.com/hashicorp/consul/api/watch"
|
"github.com/hashicorp/consul/api/watch"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type watcher struct {
|
type watcher struct {
|
||||||
|
@ -6,8 +6,9 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Option is etcd config option.
|
// Option is etcd config option.
|
||||||
|
@ -3,8 +3,9 @@ package etcd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type watcher struct {
|
type watcher struct {
|
||||||
|
@ -7,12 +7,13 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Option is kubernetes option.
|
// Option is kubernetes option.
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type watcher struct {
|
type watcher struct {
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/config"
|
|
||||||
"github.com/nacos-group/nacos-sdk-go/vo"
|
"github.com/nacos-group/nacos-sdk-go/vo"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Watcher struct {
|
type Watcher struct {
|
||||||
|
@ -7,8 +7,9 @@ import (
|
|||||||
|
|
||||||
sls "github.com/aliyun/aliyun-log-go-sdk"
|
sls "github.com/aliyun/aliyun-log-go-sdk"
|
||||||
"github.com/aliyun/aliyun-log-go-sdk/producer"
|
"github.com/aliyun/aliyun-log-go-sdk/producer"
|
||||||
log "github.com/go-kratos/kratos/v2/log"
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
log "github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Logger see more detail https://github.com/aliyun/aliyun-log-go-sdk
|
// Logger see more detail https://github.com/aliyun/aliyun-log-go-sdk
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/fluent/fluent-logger-golang/fluent"
|
"github.com/fluent/fluent-logger-golang/fluent"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package logrus
|
package logrus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ log.Logger = (*Logger)(nil)
|
var _ log.Logger = (*Logger)(nil)
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoggerLog(t *testing.T) {
|
func TestLoggerLog(t *testing.T) {
|
||||||
|
@ -6,9 +6,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
log "github.com/go-kratos/kratos/v2/log"
|
|
||||||
cls "github.com/tencentcloud/tencentcloud-cls-sdk-go"
|
cls "github.com/tencentcloud/tencentcloud-cls-sdk-go"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
log "github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Logger interface {
|
type Logger interface {
|
||||||
|
@ -3,8 +3,9 @@ package zap
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ log.Logger = (*Logger)(nil)
|
var _ log.Logger = (*Logger)(nil)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package prometheus
|
package prometheus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-kratos/kratos/v2/metrics"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ metrics.Counter = (*counter)(nil)
|
var _ metrics.Counter = (*counter)(nil)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package prometheus
|
package prometheus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-kratos/kratos/v2/metrics"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ metrics.Gauge = (*gauge)(nil)
|
var _ metrics.Gauge = (*gauge)(nil)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package prometheus
|
package prometheus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-kratos/kratos/v2/metrics"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ metrics.Observer = (*histogram)(nil)
|
var _ metrics.Observer = (*histogram)(nil)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package prometheus
|
package prometheus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-kratos/kratos/v2/metrics"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ metrics.Observer = (*summary)(nil)
|
var _ metrics.Observer = (*summary)(nil)
|
||||||
|
@ -8,8 +8,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
"github.com/hashicorp/consul/api"
|
"github.com/hashicorp/consul/api"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func tcpServer(t *testing.T, lis net.Listener) {
|
func tcpServer(t *testing.T, lis net.Listener) {
|
||||||
|
@ -10,9 +10,10 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Discovery struct {
|
type Discovery struct {
|
||||||
|
@ -6,8 +6,9 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -8,8 +8,9 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRegistry(t *testing.T) {
|
func TestRegistry(t *testing.T) {
|
||||||
|
@ -3,8 +3,9 @@ package etcd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ registry.Watcher = (*watcher)(nil)
|
var _ registry.Watcher = (*watcher)(nil)
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -21,6 +20,8 @@ import (
|
|||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
listerv1 "k8s.io/client-go/listers/core/v1"
|
listerv1 "k8s.io/client-go/listers/core/v1"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Defines the key name of specific fields
|
// Defines the key name of specific fields
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
"github.com/nacos-group/nacos-sdk-go/clients/naming_client"
|
"github.com/nacos-group/nacos-sdk-go/clients/naming_client"
|
||||||
"github.com/nacos-group/nacos-sdk-go/model"
|
"github.com/nacos-group/nacos-sdk-go/model"
|
||||||
"github.com/nacos-group/nacos-sdk-go/vo"
|
"github.com/nacos-group/nacos-sdk-go/vo"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ registry.Watcher = (*watcher)(nil)
|
var _ registry.Watcher = (*watcher)(nil)
|
||||||
|
@ -6,8 +6,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
"github.com/go-zookeeper/zk"
|
"github.com/go-zookeeper/zk"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRegistry_GetService(t *testing.T) {
|
func TestRegistry_GetService(t *testing.T) {
|
||||||
|
@ -6,8 +6,9 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
"github.com/go-zookeeper/zk"
|
"github.com/go-zookeeper/zk"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ registry.Watcher = (*watcher)(nil)
|
var _ registry.Watcher = (*watcher)(nil)
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/encoding"
|
|
||||||
"google.golang.org/protobuf/encoding/protojson"
|
"google.golang.org/protobuf/encoding/protojson"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/encoding"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name is the name registered for the json codec.
|
// Name is the name registered for the json codec.
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package yaml
|
package yaml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-kratos/kratos/v2/encoding"
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/encoding"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name is the name registered for the yaml codec.
|
// Name is the name registered for the yaml codec.
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
httpstatus "github.com/go-kratos/kratos/v2/transport/http/status"
|
|
||||||
"google.golang.org/genproto/googleapis/rpc/errdetails"
|
"google.golang.org/genproto/googleapis/rpc/errdetails"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
|
||||||
|
httpstatus "github.com/go-kratos/kratos/v2/transport/http/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/go-kratos/aegis/circuitbreaker"
|
"github.com/go-kratos/aegis/circuitbreaker"
|
||||||
"github.com/go-kratos/aegis/circuitbreaker/sre"
|
"github.com/go-kratos/aegis/circuitbreaker/sre"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/errors"
|
"github.com/go-kratos/kratos/v2/errors"
|
||||||
"github.com/go-kratos/kratos/v2/internal/group"
|
"github.com/go-kratos/kratos/v2/internal/group"
|
||||||
"github.com/go-kratos/kratos/v2/middleware"
|
"github.com/go-kratos/kratos/v2/middleware"
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/go-kratos/aegis/ratelimit"
|
"github.com/go-kratos/aegis/ratelimit"
|
||||||
"github.com/go-kratos/aegis/ratelimit/bbr"
|
"github.com/go-kratos/aegis/ratelimit/bbr"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/errors"
|
"github.com/go-kratos/kratos/v2/errors"
|
||||||
"github.com/go-kratos/kratos/v2/middleware"
|
"github.com/go-kratos/kratos/v2/middleware"
|
||||||
)
|
)
|
||||||
|
@ -3,9 +3,10 @@ package tracing
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/propagation"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2"
|
"github.com/go-kratos/kratos/v2"
|
||||||
"github.com/go-kratos/kratos/v2/metadata"
|
"github.com/go-kratos/kratos/v2/metadata"
|
||||||
"go.opentelemetry.io/otel/propagation"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const serviceHeader = "x-md-service-name"
|
const serviceHeader = "x-md-service-name"
|
||||||
|
@ -7,13 +7,14 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/internal/testdata/binding"
|
|
||||||
"github.com/go-kratos/kratos/v2/metadata"
|
|
||||||
"github.com/go-kratos/kratos/v2/transport"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
"google.golang.org/grpc/peer"
|
"google.golang.org/grpc/peer"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/internal/testdata/binding"
|
||||||
|
"github.com/go-kratos/kratos/v2/metadata"
|
||||||
|
"github.com/go-kratos/kratos/v2/transport"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_parseFullMethod(t *testing.T) {
|
func Test_parseFullMethod(t *testing.T) {
|
||||||
|
@ -4,13 +4,14 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/errors"
|
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/codes"
|
"go.opentelemetry.io/otel/codes"
|
||||||
"go.opentelemetry.io/otel/propagation"
|
"go.opentelemetry.io/otel/propagation"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tracer is otel span tracer
|
// Tracer is otel span tracer
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/internal/testdata/binding"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/internal/testdata/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_NewTracer(t *testing.T) {
|
func Test_NewTracer(t *testing.T) {
|
||||||
|
@ -5,10 +5,11 @@ import (
|
|||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/middleware"
|
|
||||||
"github.com/go-kratos/kratos/v2/transport"
|
|
||||||
"go.opentelemetry.io/otel/propagation"
|
"go.opentelemetry.io/otel/propagation"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/middleware"
|
||||||
|
"github.com/go-kratos/kratos/v2/transport"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Option is tracing option.
|
// Option is tracing option.
|
||||||
|
@ -7,11 +7,12 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"github.com/go-kratos/kratos/v2/transport"
|
|
||||||
"go.opentelemetry.io/otel/propagation"
|
"go.opentelemetry.io/otel/propagation"
|
||||||
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"github.com/go-kratos/kratos/v2/transport"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ transport.Transporter = (*mockTransport)(nil)
|
var _ transport.Transporter = (*mockTransport)(nil)
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/selector"
|
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/selector"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTrailer(t *testing.T) {
|
func TestTrailer(t *testing.T) {
|
||||||
|
@ -7,9 +7,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/middleware"
|
"github.com/go-kratos/kratos/v2/middleware"
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
"google.golang.org/grpc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWithEndpoint(t *testing.T) {
|
func TestWithEndpoint(t *testing.T) {
|
||||||
|
@ -3,10 +3,11 @@ package grpc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
enc "github.com/go-kratos/kratos/v2/encoding"
|
|
||||||
"github.com/go-kratos/kratos/v2/encoding/json"
|
|
||||||
"google.golang.org/grpc/encoding"
|
"google.golang.org/grpc/encoding"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
enc "github.com/go-kratos/kratos/v2/encoding"
|
||||||
|
"github.com/go-kratos/kratos/v2/encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -3,11 +3,12 @@ package grpc
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
grpcmd "google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
ic "github.com/go-kratos/kratos/v2/internal/context"
|
ic "github.com/go-kratos/kratos/v2/internal/context"
|
||||||
"github.com/go-kratos/kratos/v2/middleware"
|
"github.com/go-kratos/kratos/v2/middleware"
|
||||||
"github.com/go-kratos/kratos/v2/transport"
|
"github.com/go-kratos/kratos/v2/transport"
|
||||||
"google.golang.org/grpc"
|
|
||||||
grpcmd "google.golang.org/grpc/metadata"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// unaryServerInterceptor is a gRPC unary server interceptor
|
// unaryServerInterceptor is a gRPC unary server interceptor
|
||||||
|
@ -7,9 +7,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
"google.golang.org/grpc/resolver"
|
"google.golang.org/grpc/resolver"
|
||||||
"google.golang.org/grpc/serviceconfig"
|
"google.golang.org/grpc/serviceconfig"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWithInsecure(t *testing.T) {
|
func TestWithInsecure(t *testing.T) {
|
||||||
|
@ -7,8 +7,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/registry"
|
|
||||||
"google.golang.org/grpc/resolver"
|
"google.golang.org/grpc/resolver"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testClientConn struct {
|
type testClientConn struct {
|
||||||
|
@ -11,12 +11,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/errors"
|
"github.com/go-kratos/kratos/v2/errors"
|
||||||
"github.com/go-kratos/kratos/v2/internal/matcher"
|
"github.com/go-kratos/kratos/v2/internal/matcher"
|
||||||
pb "github.com/go-kratos/kratos/v2/internal/testdata/helloworld"
|
pb "github.com/go-kratos/kratos/v2/internal/testdata/helloworld"
|
||||||
"github.com/go-kratos/kratos/v2/middleware"
|
"github.com/go-kratos/kratos/v2/middleware"
|
||||||
"github.com/go-kratos/kratos/v2/transport"
|
"github.com/go-kratos/kratos/v2/transport"
|
||||||
"google.golang.org/grpc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// server is used to implement helloworld.GreeterServer.
|
// server is used to implement helloworld.GreeterServer.
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/selector"
|
"github.com/go-kratos/kratos/v2/selector"
|
||||||
"github.com/go-kratos/kratos/v2/transport"
|
"github.com/go-kratos/kratos/v2/transport"
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ transport.Transporter = (*Transport)(nil)
|
var _ transport.Transporter = (*Transport)(nil)
|
||||||
|
@ -3,8 +3,9 @@ package binding
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/internal/testdata/binding"
|
|
||||||
"google.golang.org/protobuf/types/known/fieldmaskpb"
|
"google.golang.org/protobuf/types/known/fieldmaskpb"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/internal/testdata/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProtoPath(t *testing.T) {
|
func TestProtoPath(t *testing.T) {
|
||||||
|
@ -9,10 +9,11 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
|
||||||
"github.com/go-kratos/kratos/v2/middleware"
|
"github.com/go-kratos/kratos/v2/middleware"
|
||||||
"github.com/go-kratos/kratos/v2/transport"
|
"github.com/go-kratos/kratos/v2/transport"
|
||||||
"github.com/go-kratos/kratos/v2/transport/http/binding"
|
"github.com/go-kratos/kratos/v2/transport/http/binding"
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Context = (*wrapper)(nil)
|
var _ Context = (*wrapper)(nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user