rename Kratos to kratos

pull/13/head
felixhao 6 years ago
parent fb57e4f197
commit 5d08a06525
  1. 4
      go.mod
  2. 2
      pkg/conf/dsn/dsn_test.go
  3. 4
      pkg/conf/dsn/example_test.go
  4. 8
      pkg/conf/dsn/query_test.go
  5. 2
      pkg/conf/paladin/default.go
  6. 2
      pkg/conf/paladin/example_test.go
  7. 2
      pkg/conf/paladin/map_test.go
  8. 2
      pkg/conf/paladin/mock_test.go
  9. 2
      pkg/container/pool/list_test.go
  10. 2
      pkg/container/pool/pool.go
  11. 2
      pkg/container/pool/slice_test.go
  12. 2
      pkg/container/queue/aqm/codel.go
  13. 2
      pkg/container/queue/aqm/codel_test.go
  14. 2
      pkg/log/field.go
  15. 2
      pkg/log/file.go
  16. 2
      pkg/log/internal/core/field.go
  17. 2
      pkg/log/log.go
  18. 2
      pkg/log/log_test.go
  19. 6
      pkg/log/util.go
  20. 18
      pkg/naming/discovery/discovery.go
  21. 10
      pkg/net/http/blademaster/client.go
  22. 4
      pkg/net/http/blademaster/metadata.go
  23. 2
      pkg/net/http/blademaster/trace.go
  24. 2
      pkg/net/netutil/breaker/breaker.go
  25. 6
      pkg/net/netutil/breaker/sre_breaker.go
  26. 6
      pkg/net/trace/config.go
  27. 2
      pkg/net/trace/marshal.go
  28. 2
      pkg/net/trace/span.go
  29. 8
      pkg/net/trace/util.go
  30. 2
      pkg/stat/stat.go
  31. 32
      tool/kratos/template.go
  32. 2
      tool/kratos/tool_index.go

@ -1,4 +1,4 @@
module github.com/bilibili/Kratos module github.com/bilibili/kratos
require ( require (
github.com/BurntSushi/toml v0.3.1 github.com/BurntSushi/toml v0.3.1
@ -19,3 +19,5 @@ require (
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v9 v9.26.0 gopkg.in/go-playground/validator.v9 v9.26.0
) )
go 1.12

@ -6,7 +6,7 @@ import (
"testing" "testing"
"time" "time"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
type config struct { type config struct {

@ -3,8 +3,8 @@ package dsn_test
import ( import (
"log" "log"
"github.com/bilibili/Kratos/pkg/conf/dsn" "github.com/bilibili/kratos/pkg/conf/dsn"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
// Config struct // Config struct

@ -6,7 +6,7 @@ import (
"testing" "testing"
"time" "time"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
type cfg1 struct { type cfg1 struct {
@ -66,7 +66,7 @@ func TestDecodeQuery(t *testing.T) {
}, },
}, },
{ {
name: "test github.com/bilibili/Kratos/pkg/time", name: "test github.com/bilibili/kratos/pkg/time",
args: args{ args: args{
query: url.Values{ query: url.Values{
"timeout": {"1s"}, "timeout": {"1s"},
@ -77,7 +77,7 @@ func TestDecodeQuery(t *testing.T) {
cfg: &cfg2{xtime.Duration(time.Second)}, cfg: &cfg2{xtime.Duration(time.Second)},
}, },
{ {
name: "test empty github.com/bilibili/Kratos/pkg/time", name: "test empty github.com/bilibili/kratos/pkg/time",
args: args{ args: args{
query: url.Values{}, query: url.Values{},
v: &cfg2{}, v: &cfg2{},
@ -86,7 +86,7 @@ func TestDecodeQuery(t *testing.T) {
cfg: &cfg2{}, cfg: &cfg2{},
}, },
{ {
name: "test github.com/bilibili/Kratos/pkg/time", name: "test github.com/bilibili/kratos/pkg/time",
args: args{ args: args{
query: url.Values{}, query: url.Values{},
v: &cfg4{}, v: &cfg4{},

@ -4,7 +4,7 @@ import (
"context" "context"
"flag" "flag"
"github.com/bilibili/Kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
) )
var ( var (

@ -4,7 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
) )

@ -3,7 +3,7 @@ package paladin_test
import ( import (
"testing" "testing"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"

@ -3,7 +3,7 @@ package paladin_test
import ( import (
"testing" "testing"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

@ -6,7 +6,7 @@ import (
"testing" "testing"
"time" "time"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

@ -6,7 +6,7 @@ import (
"io" "io"
"time" "time"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
var ( var (

@ -6,7 +6,7 @@ import (
"testing" "testing"
"time" "time"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

@ -6,7 +6,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/bilibili/Kratos/pkg/ecode" "github.com/bilibili/kratos/pkg/ecode"
) )
// Config codel config. // Config codel config.

@ -8,7 +8,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/bilibili/Kratos/pkg/ecode" "github.com/bilibili/kratos/pkg/ecode"
) )
var testConf = &Config{ var testConf = &Config{

@ -4,7 +4,7 @@ import (
"math" "math"
"time" "time"
"github.com/bilibili/Kratos/pkg/log/internal/core" "github.com/bilibili/kratos/pkg/log/internal/core"
) )
// D represents a map of entry level data used for structured logging. // D represents a map of entry level data used for structured logging.

@ -6,7 +6,7 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/bilibili/Kratos/pkg/log/internal/filewriter" "github.com/bilibili/kratos/pkg/log/internal/filewriter"
) )
// level idx // level idx

@ -5,7 +5,7 @@ import (
"math" "math"
"time" "time"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
// FieldType represent D value type // FieldType represent D value type

@ -8,7 +8,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/bilibili/Kratos/pkg/conf/env" "github.com/bilibili/kratos/pkg/conf/env"
) )
// Config log config. // Config log config.

@ -4,7 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/bilibili/Kratos/pkg/net/metadata" "github.com/bilibili/kratos/pkg/net/metadata"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

@ -6,9 +6,9 @@ import (
"runtime" "runtime"
"strconv" "strconv"
"github.com/bilibili/Kratos/pkg/conf/env" "github.com/bilibili/kratos/pkg/conf/env"
"github.com/bilibili/Kratos/pkg/net/metadata" "github.com/bilibili/kratos/pkg/net/metadata"
"github.com/bilibili/Kratos/pkg/net/trace" "github.com/bilibili/kratos/pkg/net/trace"
) )
func addExtraField(ctx context.Context, fields map[string]interface{}) { func addExtraField(ctx context.Context, fields map[string]interface{}) {

@ -14,15 +14,15 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/bilibili/Kratos/pkg/conf/env" "github.com/bilibili/kratos/pkg/conf/env"
"github.com/bilibili/Kratos/pkg/ecode" "github.com/bilibili/kratos/pkg/ecode"
"github.com/bilibili/Kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
"github.com/bilibili/Kratos/pkg/naming" "github.com/bilibili/kratos/pkg/naming"
bm "github.com/bilibili/Kratos/pkg/net/http/blademaster" bm "github.com/bilibili/kratos/pkg/net/http/blademaster"
"github.com/bilibili/Kratos/pkg/net/netutil" "github.com/bilibili/kratos/pkg/net/netutil"
"github.com/bilibili/Kratos/pkg/net/netutil/breaker" "github.com/bilibili/kratos/pkg/net/netutil/breaker"
xstr "github.com/bilibili/Kratos/pkg/str" xstr "github.com/bilibili/kratos/pkg/str"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
const ( const (

@ -17,11 +17,11 @@ import (
"sync" "sync"
"time" "time"
"github.com/bilibili/Kratos/pkg/conf/env" "github.com/bilibili/kratos/pkg/conf/env"
"github.com/bilibili/Kratos/pkg/net/metadata" "github.com/bilibili/kratos/pkg/net/metadata"
"github.com/bilibili/Kratos/pkg/net/netutil/breaker" "github.com/bilibili/kratos/pkg/net/netutil/breaker"
"github.com/bilibili/Kratos/pkg/stat" "github.com/bilibili/kratos/pkg/stat"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
pkgerr "github.com/pkg/errors" pkgerr "github.com/pkg/errors"

@ -6,8 +6,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/bilibili/Kratos/pkg/conf/env" "github.com/bilibili/kratos/pkg/conf/env"
"github.com/bilibili/Kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"net/http/httptrace" "net/http/httptrace"
"github.com/bilibili/Kratos/pkg/net/trace" "github.com/bilibili/kratos/pkg/net/trace"
) )
const _defaultComponentName = "net/http" const _defaultComponentName = "net/http"

@ -4,7 +4,7 @@ import (
"sync" "sync"
"time" "time"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
// Config broker config. // Config broker config.

@ -6,9 +6,9 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/bilibili/Kratos/pkg/ecode" "github.com/bilibili/kratos/pkg/ecode"
"github.com/bilibili/Kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
"github.com/bilibili/Kratos/pkg/stat/summary" "github.com/bilibili/kratos/pkg/stat/summary"
) )
// sreBreaker is a sre CircuitBreaker pattern. // sreBreaker is a sre CircuitBreaker pattern.

@ -8,9 +8,9 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/bilibili/Kratos/pkg/conf/dsn" "github.com/bilibili/kratos/pkg/conf/dsn"
"github.com/bilibili/Kratos/pkg/conf/env" "github.com/bilibili/kratos/pkg/conf/env"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
var _traceDSN = "unixgram:///var/run/dapper-collect/dapper-collect.sock" var _traceDSN = "unixgram:///var/run/dapper-collect/dapper-collect.sock"

@ -11,7 +11,7 @@ import (
"github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/duration"
"github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/timestamp"
protogen "github.com/bilibili/Kratos/pkg/net/trace/proto" protogen "github.com/bilibili/kratos/pkg/net/trace/proto"
) )
const protoVersion1 int32 = 1 const protoVersion1 int32 = 1

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
protogen "github.com/bilibili/Kratos/pkg/net/trace/proto" protogen "github.com/bilibili/kratos/pkg/net/trace/proto"
) )
const ( const (

@ -6,9 +6,9 @@ import (
"math/rand" "math/rand"
"time" "time"
"github.com/bilibili/Kratos/pkg/conf/env" "github.com/bilibili/kratos/pkg/conf/env"
"github.com/bilibili/Kratos/pkg/net/ip" "github.com/bilibili/kratos/pkg/net/ip"
"github.com/bilibili/Kratos/pkg/net/metadata" "github.com/bilibili/kratos/pkg/net/metadata"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -45,7 +45,7 @@ type stackTracer interface {
type ctxKey string type ctxKey string
var _ctxkey ctxKey = "Kratos/pkg/net/trace.trace" var _ctxkey ctxKey = "kratos/pkg/net/trace.trace"
// FromContext returns the trace bound to the context, if any. // FromContext returns the trace bound to the context, if any.
func FromContext(ctx context.Context) (t Trace, ok bool) { func FromContext(ctx context.Context) (t Trace, ok bool) {

@ -1,7 +1,7 @@
package stat package stat
import ( import (
"github.com/bilibili/Kratos/pkg/stat/prom" "github.com/bilibili/kratos/pkg/stat/prom"
) )
// Stat interface. // Stat interface.

@ -75,8 +75,8 @@ import (
"{{.Name}}/internal/server/grpc" "{{.Name}}/internal/server/grpc"
"{{.Name}}/internal/server/http" "{{.Name}}/internal/server/http"
"{{.Name}}/internal/service" "{{.Name}}/internal/service"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/Kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
) )
func main() { func main() {
@ -126,12 +126,12 @@ import (
"context" "context"
"time" "time"
"github.com/bilibili/Kratos/pkg/cache/memcache" "github.com/bilibili/kratos/pkg/cache/memcache"
"github.com/bilibili/Kratos/pkg/cache/redis" "github.com/bilibili/kratos/pkg/cache/redis"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/Kratos/pkg/database/sql" "github.com/bilibili/kratos/pkg/database/sql"
"github.com/bilibili/Kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
xtime "github.com/bilibili/Kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
) )
// Dao dao. // Dao dao.
@ -233,7 +233,7 @@ import (
"context" "context"
"{{.Name}}/internal/dao" "{{.Name}}/internal/dao"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
) )
// Service service. // Service service.
@ -274,7 +274,7 @@ import (
pb "{{.Name}}/api" pb "{{.Name}}/api"
"{{.Name}}/internal/dao" "{{.Name}}/internal/dao"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/golang/protobuf/ptypes/empty" "github.com/golang/protobuf/ptypes/empty"
) )
@ -321,10 +321,10 @@ import (
"net/http" "net/http"
"{{.Name}}/internal/service" "{{.Name}}/internal/service"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/Kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
bm "github.com/bilibili/Kratos/pkg/net/http/blademaster" bm "github.com/bilibili/kratos/pkg/net/http/blademaster"
"github.com/bilibili/Kratos/pkg/net/http/blademaster/middleware/verify" "github.com/bilibili/kratos/pkg/net/http/blademaster/middleware/verify"
) )
var ( var (
@ -425,8 +425,8 @@ message HelloReq {
import ( import (
pb "{{.Name}}/api" pb "{{.Name}}/api"
"{{.Name}}/internal/service" "{{.Name}}/internal/service"
"github.com/bilibili/Kratos/pkg/conf/paladin" "github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/Kratos/pkg/net/rpc/warden" "github.com/bilibili/kratos/pkg/net/rpc/warden"
) )
// New new a grpc server. // New new a grpc server.

@ -6,7 +6,7 @@ var toolIndexs = []*Tool{
&Tool{ &Tool{
Name: "kratos", Name: "kratos",
BuildTime: time.Date(2019, 4, 2, 0, 0, 0, 0, time.Local), BuildTime: time.Date(2019, 4, 2, 0, 0, 0, 0, time.Local),
Install: "go get -u github.com/bilibili/Kratos/tool/kratos", Install: "go get -u github.com/bilibili/kratos/tool/kratos",
Summary: "Kratos工具集本体", Summary: "Kratos工具集本体",
Platform: []string{"darwin", "linux", "windows"}, Platform: []string{"darwin", "linux", "windows"},
Author: "kratos", Author: "kratos",

Loading…
Cancel
Save