From dd8e0a1a4383d99047ef944c0c0dc7c04f56118a Mon Sep 17 00:00:00 2001 From: zhouzj Date: Sat, 20 Mar 2021 14:03:04 +0800 Subject: [PATCH] recodeGo --- Go/README.md | 2 +- Go/source/{yitidgen => }/contract/IIdGenerator.go | 0 Go/source/{yitidgen => }/contract/ISnowWorker.go | 0 Go/source/{yitidgen => }/contract/IdGeneratorException.go | 0 Go/source/{yitidgen => }/contract/IdGeneratorOptions.go | 0 Go/source/{yitidgen => }/contract/OverCostActionArg.go | 0 Go/source/{yitidgen => }/core/snowWorkerM1.go | 2 +- Go/source/{yitidgen => }/core/snowWorkerM2.go | 2 +- Go/source/go.mod | 1 + Go/source/{yitidgen => }/idgen/DefaultIdGenerator.go | 4 ++-- Go/source/{yitidgen => }/idgen/YitIdHelper.go | 2 +- Go/source/test/main.go | 4 ++-- 12 files changed, 9 insertions(+), 8 deletions(-) rename Go/source/{yitidgen => }/contract/IIdGenerator.go (100%) rename Go/source/{yitidgen => }/contract/ISnowWorker.go (100%) rename Go/source/{yitidgen => }/contract/IdGeneratorException.go (100%) rename Go/source/{yitidgen => }/contract/IdGeneratorOptions.go (100%) rename Go/source/{yitidgen => }/contract/OverCostActionArg.go (100%) rename Go/source/{yitidgen => }/core/snowWorkerM1.go (99%) rename Go/source/{yitidgen => }/core/snowWorkerM2.go (98%) create mode 100644 Go/source/go.mod rename Go/source/{yitidgen => }/idgen/DefaultIdGenerator.go (98%) rename Go/source/{yitidgen => }/idgen/YitIdHelper.go (97%) diff --git a/Go/README.md b/Go/README.md index 674580b..fcfd866 100644 --- a/Go/README.md +++ b/Go/README.md @@ -4,7 +4,7 @@ 1.go 1.16 -2. 默认采用GOROOT方式编译,你可修改为Go-Modules +2. 启用Go-Modules ## Go代码示例 diff --git a/Go/source/yitidgen/contract/IIdGenerator.go b/Go/source/contract/IIdGenerator.go similarity index 100% rename from Go/source/yitidgen/contract/IIdGenerator.go rename to Go/source/contract/IIdGenerator.go diff --git a/Go/source/yitidgen/contract/ISnowWorker.go b/Go/source/contract/ISnowWorker.go similarity index 100% rename from Go/source/yitidgen/contract/ISnowWorker.go rename to Go/source/contract/ISnowWorker.go diff --git a/Go/source/yitidgen/contract/IdGeneratorException.go b/Go/source/contract/IdGeneratorException.go similarity index 100% rename from Go/source/yitidgen/contract/IdGeneratorException.go rename to Go/source/contract/IdGeneratorException.go diff --git a/Go/source/yitidgen/contract/IdGeneratorOptions.go b/Go/source/contract/IdGeneratorOptions.go similarity index 100% rename from Go/source/yitidgen/contract/IdGeneratorOptions.go rename to Go/source/contract/IdGeneratorOptions.go diff --git a/Go/source/yitidgen/contract/OverCostActionArg.go b/Go/source/contract/OverCostActionArg.go similarity index 100% rename from Go/source/yitidgen/contract/OverCostActionArg.go rename to Go/source/contract/OverCostActionArg.go diff --git a/Go/source/yitidgen/core/snowWorkerM1.go b/Go/source/core/snowWorkerM1.go similarity index 99% rename from Go/source/yitidgen/core/snowWorkerM1.go rename to Go/source/core/snowWorkerM1.go index 6a56e0f..4115092 100644 --- a/Go/source/yitidgen/core/snowWorkerM1.go +++ b/Go/source/core/snowWorkerM1.go @@ -7,10 +7,10 @@ package core import ( - "../contract" "math" "sync" "time" + "yitidgen/contract" ) type SnowWorkerM1 struct { diff --git a/Go/source/yitidgen/core/snowWorkerM2.go b/Go/source/core/snowWorkerM2.go similarity index 98% rename from Go/source/yitidgen/core/snowWorkerM2.go rename to Go/source/core/snowWorkerM2.go index 9cdb9e9..7a08d01 100644 --- a/Go/source/yitidgen/core/snowWorkerM2.go +++ b/Go/source/core/snowWorkerM2.go @@ -7,10 +7,10 @@ package core import ( - "../contract" "fmt" "strconv" "sync/atomic" + "yitidgen/contract" ) type SnowWorkerM2 struct { diff --git a/Go/source/go.mod b/Go/source/go.mod new file mode 100644 index 0000000..8eafd7d --- /dev/null +++ b/Go/source/go.mod @@ -0,0 +1 @@ +module "yitidgen" \ No newline at end of file diff --git a/Go/source/yitidgen/idgen/DefaultIdGenerator.go b/Go/source/idgen/DefaultIdGenerator.go similarity index 98% rename from Go/source/yitidgen/idgen/DefaultIdGenerator.go rename to Go/source/idgen/DefaultIdGenerator.go index 2a6278d..a137b21 100644 --- a/Go/source/yitidgen/idgen/DefaultIdGenerator.go +++ b/Go/source/idgen/DefaultIdGenerator.go @@ -7,10 +7,10 @@ package idgen import ( - "../contract" - "../core" "math" "time" + "yitidgen/contract" + "yitidgen/core" ) type DefaultIdGenerator struct { diff --git a/Go/source/yitidgen/idgen/YitIdHelper.go b/Go/source/idgen/YitIdHelper.go similarity index 97% rename from Go/source/yitidgen/idgen/YitIdHelper.go rename to Go/source/idgen/YitIdHelper.go index 491cee7..a6c47a3 100644 --- a/Go/source/yitidgen/idgen/YitIdHelper.go +++ b/Go/source/idgen/YitIdHelper.go @@ -7,8 +7,8 @@ package idgen import ( - "../contract" "sync" + "yitidgen/contract" ) var ins *YitIdHelper diff --git a/Go/source/test/main.go b/Go/source/test/main.go index 0d96aa9..e25925c 100644 --- a/Go/source/test/main.go +++ b/Go/source/test/main.go @@ -1,10 +1,10 @@ package main import ( - "../yitidgen/contract" - "../yitidgen/idgen" "fmt" "time" + "yitidgen/contract" + "yitidgen/idgen" ) func main() {