From bac4f410ad183493fa84b711088c5b713afa8a7c Mon Sep 17 00:00:00 2001 From: NorthLan <6995syu@163.com> Date: Tue, 19 Apr 2022 15:55:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9module=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E9=80=82=E5=BA=94=E7=A7=81=E6=9C=89=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster/acceptor.go | 8 ++++---- cluster/agent.go | 16 ++++++++-------- cluster/cluster.go | 4 ++-- cluster/connpool.go | 2 +- cluster/handler.go | 20 ++++++++++---------- cluster/member.go | 2 +- cluster/node.go | 16 ++++++++-------- go.mod | 2 +- group.go | 8 ++++---- group_test.go | 2 +- interface.go | 12 ++++++------ internal/codec/codec.go | 2 +- internal/codec/codec_test.go | 2 +- internal/env/env.go | 4 ++-- internal/message/message.go | 2 +- internal/message/util.go | 2 +- internal/runtime/runtime.go | 2 +- options.go | 14 +++++++------- pipeline/pipeline.go | 4 ++-- scheduler/scheduler.go | 4 ++-- scheduler/timer.go | 2 +- serialize/json/json.go | 2 +- serialize/protobuf/protobuf.go | 2 +- serialize/protobuf/protobuf_test.go | 2 +- session/session.go | 2 +- 25 files changed, 69 insertions(+), 69 deletions(-) diff --git a/cluster/acceptor.go b/cluster/acceptor.go index 6f7de22..8bd2775 100644 --- a/cluster/acceptor.go +++ b/cluster/acceptor.go @@ -2,11 +2,11 @@ package cluster import ( "context" + "git.noahlan.cn/northlan/ngs/cluster/clusterpb" + "git.noahlan.cn/northlan/ngs/internal/message" + "git.noahlan.cn/northlan/ngs/mock" + "git.noahlan.cn/northlan/ngs/session" "net" - "ngs/cluster/clusterpb" - "ngs/internal/message" - "ngs/mock" - "ngs/session" ) type acceptor struct { diff --git a/cluster/agent.go b/cluster/agent.go index a649d74..02f79c3 100644 --- a/cluster/agent.go +++ b/cluster/agent.go @@ -3,15 +3,15 @@ package cluster import ( "errors" "fmt" + "git.noahlan.cn/northlan/ngs/internal/codec" + "git.noahlan.cn/northlan/ngs/internal/env" + "git.noahlan.cn/northlan/ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/message" + "git.noahlan.cn/northlan/ngs/internal/packet" + "git.noahlan.cn/northlan/ngs/pipeline" + "git.noahlan.cn/northlan/ngs/scheduler" + "git.noahlan.cn/northlan/ngs/session" "net" - "ngs/internal/codec" - "ngs/internal/env" - "ngs/internal/log" - "ngs/internal/message" - "ngs/internal/packet" - "ngs/pipeline" - "ngs/scheduler" - "ngs/session" "reflect" "sync/atomic" "time" diff --git a/cluster/cluster.go b/cluster/cluster.go index 243f66e..9ff0a0a 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -3,8 +3,8 @@ package cluster import ( "context" "fmt" - "ngs/cluster/clusterpb" - "ngs/internal/log" + "git.noahlan.cn/northlan/ngs/cluster/clusterpb" + "git.noahlan.cn/northlan/ngs/internal/log" "sync" ) diff --git a/cluster/connpool.go b/cluster/connpool.go index ed2ce0c..671f882 100644 --- a/cluster/connpool.go +++ b/cluster/connpool.go @@ -3,8 +3,8 @@ package cluster import ( "context" "errors" + "git.noahlan.cn/northlan/ngs/internal/env" "google.golang.org/grpc" - "ngs/internal/env" "sync" "sync/atomic" "time" diff --git a/cluster/handler.go b/cluster/handler.go index ab21f92..edbcdf2 100644 --- a/cluster/handler.go +++ b/cluster/handler.go @@ -4,19 +4,19 @@ import ( "context" "encoding/json" "fmt" + "git.noahlan.cn/northlan/ngs/cluster/clusterpb" + "git.noahlan.cn/northlan/ngs/component" + "git.noahlan.cn/northlan/ngs/internal/codec" + "git.noahlan.cn/northlan/ngs/internal/env" + "git.noahlan.cn/northlan/ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/message" + "git.noahlan.cn/northlan/ngs/internal/packet" + "git.noahlan.cn/northlan/ngs/pipeline" + "git.noahlan.cn/northlan/ngs/scheduler" + "git.noahlan.cn/northlan/ngs/session" "github.com/gorilla/websocket" "math/rand" "net" - "ngs/cluster/clusterpb" - "ngs/component" - "ngs/internal/codec" - "ngs/internal/env" - "ngs/internal/log" - "ngs/internal/message" - "ngs/internal/packet" - "ngs/pipeline" - "ngs/scheduler" - "ngs/session" "reflect" "sort" "strings" diff --git a/cluster/member.go b/cluster/member.go index 22e3f38..55af441 100644 --- a/cluster/member.go +++ b/cluster/member.go @@ -1,6 +1,6 @@ package cluster -import "ngs/cluster/clusterpb" +import "git.noahlan.cn/northlan/ngs/cluster/clusterpb" type Member struct { isMaster bool diff --git a/cluster/node.go b/cluster/node.go index f78db6b..37c1690 100644 --- a/cluster/node.go +++ b/cluster/node.go @@ -4,18 +4,18 @@ import ( "context" "errors" "fmt" + "git.noahlan.cn/northlan/ngs/cluster/clusterpb" + "git.noahlan.cn/northlan/ngs/component" + "git.noahlan.cn/northlan/ngs/internal/env" + "git.noahlan.cn/northlan/ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/message" + "git.noahlan.cn/northlan/ngs/pipeline" + "git.noahlan.cn/northlan/ngs/scheduler" + "git.noahlan.cn/northlan/ngs/session" "github.com/gorilla/websocket" "google.golang.org/grpc" "net" "net/http" - "ngs/cluster/clusterpb" - "ngs/component" - "ngs/internal/env" - "ngs/internal/log" - "ngs/internal/message" - "ngs/pipeline" - "ngs/scheduler" - "ngs/session" "strings" "sync" "time" diff --git a/go.mod b/go.mod index 5181d7f..21dfac3 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module ngs +module git.noahlan.cn/northlan/ngs go 1.18 diff --git a/group.go b/group.go index a77abe1..23e1d21 100644 --- a/group.go +++ b/group.go @@ -2,10 +2,10 @@ package ngs import ( "fmt" - "ngs/internal/env" - "ngs/internal/log" - "ngs/internal/message" - "ngs/session" + "git.noahlan.cn/northlan/ngs/internal/env" + "git.noahlan.cn/northlan/ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/message" + "git.noahlan.cn/northlan/ngs/session" "sync" "sync/atomic" ) diff --git a/group_test.go b/group_test.go index e084607..7d20e5a 100644 --- a/group_test.go +++ b/group_test.go @@ -1,8 +1,8 @@ package ngs import ( + "git.noahlan.cn/northlan/ngs/session" "math/rand" - "ngs/session" "testing" ) diff --git a/interface.go b/interface.go index ba79da4..abc7538 100644 --- a/interface.go +++ b/interface.go @@ -2,12 +2,12 @@ package ngs import ( "fmt" - "ngs/cluster" - "ngs/component" - "ngs/internal/env" - "ngs/internal/log" - "ngs/internal/runtime" - "ngs/scheduler" + "git.noahlan.cn/northlan/ngs/cluster" + "git.noahlan.cn/northlan/ngs/component" + "git.noahlan.cn/northlan/ngs/internal/env" + "git.noahlan.cn/northlan/ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/runtime" + "git.noahlan.cn/northlan/ngs/scheduler" "os" "os/signal" "path/filepath" diff --git a/internal/codec/codec.go b/internal/codec/codec.go index 41bff8b..94df57f 100644 --- a/internal/codec/codec.go +++ b/internal/codec/codec.go @@ -3,7 +3,7 @@ package codec import ( "bytes" "errors" - "ngs/internal/packet" + "git.noahlan.cn/northlan/ngs/internal/packet" ) // Codec constants. diff --git a/internal/codec/codec_test.go b/internal/codec/codec_test.go index 0dd8dd0..f26645a 100644 --- a/internal/codec/codec_test.go +++ b/internal/codec/codec_test.go @@ -1,7 +1,7 @@ package codec import ( - . "ngs/internal/packet" + . "git.noahlan.cn/northlan/ngs/internal/packet" "reflect" "testing" ) diff --git a/internal/env/env.go b/internal/env/env.go index 2cb2b3a..58912f5 100644 --- a/internal/env/env.go +++ b/internal/env/env.go @@ -1,11 +1,11 @@ package env import ( + "git.noahlan.cn/northlan/ngs/serialize" + "git.noahlan.cn/northlan/ngs/serialize/protobuf" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "net/http" - "ngs/serialize" - "ngs/serialize/protobuf" "time" ) diff --git a/internal/message/message.go b/internal/message/message.go index 8c0c251..98416ed 100644 --- a/internal/message/message.go +++ b/internal/message/message.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "errors" "fmt" - "ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/log" "strings" ) diff --git a/internal/message/util.go b/internal/message/util.go index ad984c4..2e6bcd6 100644 --- a/internal/message/util.go +++ b/internal/message/util.go @@ -1,6 +1,6 @@ package message -import "ngs/internal/env" +import "git.noahlan.cn/northlan/ngs/internal/env" func Serialize(v interface{}) ([]byte, error) { if data, ok := v.([]byte); ok { diff --git a/internal/runtime/runtime.go b/internal/runtime/runtime.go index 0f44df3..34fdcc6 100644 --- a/internal/runtime/runtime.go +++ b/internal/runtime/runtime.go @@ -1,5 +1,5 @@ package runtime -import "ngs/cluster" +import "git.noahlan.cn/northlan/ngs/cluster" var CurrentNode *cluster.Node diff --git a/options.go b/options.go index 51f20bc..46055da 100644 --- a/options.go +++ b/options.go @@ -1,15 +1,15 @@ package ngs import ( + "git.noahlan.cn/northlan/ngs/cluster" + "git.noahlan.cn/northlan/ngs/component" + "git.noahlan.cn/northlan/ngs/internal/env" + "git.noahlan.cn/northlan/ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/message" + "git.noahlan.cn/northlan/ngs/pipeline" + "git.noahlan.cn/northlan/ngs/serialize" "google.golang.org/grpc" "net/http" - "ngs/cluster" - "ngs/component" - "ngs/internal/env" - "ngs/internal/log" - "ngs/internal/message" - "ngs/pipeline" - "ngs/serialize" "time" ) diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index f1c2e16..83d3dba 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -1,8 +1,8 @@ package pipeline import ( - "ngs/internal/message" - "ngs/session" + "git.noahlan.cn/northlan/ngs/internal/message" + "git.noahlan.cn/northlan/ngs/session" "sync" ) diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go index 316164c..7b3fbad 100644 --- a/scheduler/scheduler.go +++ b/scheduler/scheduler.go @@ -2,8 +2,8 @@ package scheduler import ( "fmt" - "ngs/internal/env" - "ngs/internal/log" + "git.noahlan.cn/northlan/ngs/internal/env" + "git.noahlan.cn/northlan/ngs/internal/log" "runtime/debug" "sync/atomic" "time" diff --git a/scheduler/timer.go b/scheduler/timer.go index 7738a4a..d33f681 100644 --- a/scheduler/timer.go +++ b/scheduler/timer.go @@ -2,8 +2,8 @@ package scheduler import ( "fmt" + "git.noahlan.cn/northlan/ngs/internal/log" "math" - "ngs/internal/log" "runtime/debug" "sync" "sync/atomic" diff --git a/serialize/json/json.go b/serialize/json/json.go index 8261d1d..b9ba9a4 100644 --- a/serialize/json/json.go +++ b/serialize/json/json.go @@ -2,7 +2,7 @@ package json import ( "encoding/json" - "ngs/serialize" + "git.noahlan.cn/northlan/ngs/serialize" ) // Serializer implements the serialize.Serializer interface diff --git a/serialize/protobuf/protobuf.go b/serialize/protobuf/protobuf.go index f59b2e5..1cbb96f 100644 --- a/serialize/protobuf/protobuf.go +++ b/serialize/protobuf/protobuf.go @@ -2,8 +2,8 @@ package protobuf import ( "errors" + "git.noahlan.cn/northlan/ngs/serialize" "google.golang.org/protobuf/proto" - "ngs/serialize" ) // ErrWrongValueType is the error used for marshal the value with protobuf encoding. diff --git a/serialize/protobuf/protobuf_test.go b/serialize/protobuf/protobuf_test.go index 46657cc..8c19c54 100644 --- a/serialize/protobuf/protobuf_test.go +++ b/serialize/protobuf/protobuf_test.go @@ -1,8 +1,8 @@ package protobuf import ( + "git.noahlan.cn/northlan/ngs/benchmark/testdata" "google.golang.org/protobuf/proto" - "ngs/benchmark/testdata" "testing" ) diff --git a/session/session.go b/session/session.go index b55cbb0..b383001 100644 --- a/session/session.go +++ b/session/session.go @@ -2,8 +2,8 @@ package session import ( "errors" + "git.noahlan.cn/northlan/ngs/service" "net" - "ngs/service" "sync" "sync/atomic" "time"