Skip to content

Commit

Permalink
refactor: Move go-sdk to separate repo (#1077)
Browse files Browse the repository at this point in the history
* Move go-sdk to separate repo

Signed-off-by: “huazhongming” <crazyhzm@apache.org>

* remove .gitmodule

Signed-off-by: “huazhongming” <crazyhzm@apache.org>

* format code

Signed-off-by: “huazhongming” <crazyhzm@apache.org>

* format code

Signed-off-by: “huazhongming” <crazyhzm@apache.org>

* remove go-sdk test coverage

Signed-off-by: “huazhongming” <crazyhzm@apache.org>

---------

Signed-off-by: “huazhongming” <crazyhzm@apache.org>
  • Loading branch information
CrazyHZM authored Nov 18, 2024
1 parent b4fed4d commit 576685d
Show file tree
Hide file tree
Showing 49 changed files with 35 additions and 3,131 deletions.
Empty file removed .gitmodules
Empty file.
1 change: 0 additions & 1 deletion components/pluggable/grpc_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func TestServerFor[TServer any, TClient any](registersvc func(grpc.ServiceRegist
// client, cleanup, err := serverFactory(&your_service{})
// require.NoError(t, err)
// defer cleanup()
//
func TestSocketServerFor[TServer any, TClient any](registersvc func(grpc.ServiceRegistrar, TServer), clientFactory func(GRPCConnectionDialer) TClient) func(svc TServer) (client TClient, cleanup func(), err error) {
return func(srv TServer) (client TClient, cleanup func(), err error) {
const fakeSocketFolder = "/tmp"
Expand Down
7 changes: 3 additions & 4 deletions components/sequencer/snowflake/snowflake.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -242,9 +241,9 @@ func NewMysqlClient(meta *SnowflakeMysqlMetadata) (int64, error) {
return workId, err
}

//get id from mysql
//host_name = "ip"
//port = "timestamp-random number"
// get id from mysql
// host_name = "ip"
// port = "timestamp-random number"
func NewWorkId(meta SnowflakeMysqlMetadata) (int64, error) {
var workId int64
ip, err := getIP()
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/snowflake/snowflake_sequencer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/snowflake/snowflake_sequencer_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/snowflake/snowflake_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion demo/configuration/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (

"google.golang.org/grpc"

client "mosn.io/layotto/sdk/go-sdk/client"
client "github.com/layotto/go-sdk/client"

runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1"
)

Expand Down
5 changes: 2 additions & 3 deletions demo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ require (
google.golang.org/protobuf v1.27.1
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
mosn.io/layotto/sdk/go-sdk v0.0.0-20211020084508-6f5ee3cfeba0
mosn.io/layotto/spec v0.0.0-20220413092851-55c58dbb1a23
github.com/layotto/go-sdk v0.0.0-20241113124402-e55ee5816d2f // indirect
mosn.io/layotto/spec v0.0.0-20240927030843-b4fed4d06be4
)

replace (
mosn.io/layotto/sdk/go-sdk => ../sdk/go-sdk
mosn.io/layotto/spec => ../spec

)
5 changes: 5 additions & 0 deletions demo/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/layotto/go-sdk v0.0.0-20241113124402-e55ee5816d2f h1:xm1tsLV09M6if6AzHIb7PVMpGwNB9iEDwujcSNvxMtY=
github.com/layotto/go-sdk v0.0.0-20241113124402-e55ee5816d2f/go.mod h1:wsC0WVxh+E/n7WpsBL7KnHCfwWjcWLee9j73M4vtQ2c=
github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/minio-go/v7 v7.0.15 h1:r9/NhjJ+nXYrIYvbObhvc1wPj3YH1iDpJzz61uRKLyY=
Expand Down Expand Up @@ -231,3 +233,6 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
mosn.io/layotto/sdk/go-sdk v0.0.0-20211020084508-6f5ee3cfeba0 h1:7VrXO1rhre6jEi/AefiSAJKcBN2S1A4xyftGwQtplxo=
mosn.io/layotto/sdk/go-sdk v0.0.0-20211020084508-6f5ee3cfeba0/go.mod h1:8mz11AqaMK42eseRmD4LvCXM3THklAuuKklkQ3FYPpw=
mosn.io/layotto/sdk/go-sdk v0.0.0-20240927030843-b4fed4d06be4/go.mod h1:vfiOK6P29QD8Ti5NTeTfWamLN3EzrcCQD1tpldX4K3Y=
2 changes: 1 addition & 1 deletion demo/hello/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"
"log"

"mosn.io/layotto/sdk/go-sdk/client"
"github.com/layotto/go-sdk/client"
)

var storeName string
Expand Down
3 changes: 2 additions & 1 deletion demo/lock/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (

"github.com/google/uuid"

client "mosn.io/layotto/sdk/go-sdk/client"
client "github.com/layotto/go-sdk/client"

runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion demo/pubsub/client/publish_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"flag"
"fmt"

client "mosn.io/layotto/sdk/go-sdk/client"
client "github.com/layotto/go-sdk/client"
)

var storeName string
Expand Down
3 changes: 2 additions & 1 deletion demo/secret/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
"flag"
"fmt"

"mosn.io/layotto/sdk/go-sdk/client"
"github.com/layotto/go-sdk/client"

runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1"
)

Expand Down
3 changes: 2 additions & 1 deletion demo/sequencer/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (
"flag"
"fmt"

client "mosn.io/layotto/sdk/go-sdk/client"
client "github.com/layotto/go-sdk/client"

runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion demo/state/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"flag"
"fmt"

client "mosn.io/layotto/sdk/go-sdk/client"
client "github.com/layotto/go-sdk/client"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion demo/state/k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/avast/retry-go"

client "mosn.io/layotto/sdk/go-sdk/client"
client "github.com/layotto/go-sdk/client"
)

const (
Expand Down
8 changes: 3 additions & 5 deletions demo/state/k8s/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ module client

go 1.18

require (
github.com/avast/retry-go v3.0.0+incompatible
mosn.io/layotto/sdk/go-sdk v0.0.0-20230920030758-dbf443e27376
)
require github.com/avast/retry-go v3.0.0+incompatible

require (
github.com/golang/protobuf v1.5.0 // indirect
github.com/layotto/go-sdk v0.0.0-20241113124402-e55ee5816d2f
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect
golang.org/x/text v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/grpc v1.37.0 // indirect
google.golang.org/protobuf v1.26.0-rc.1 // indirect
mosn.io/layotto/spec v0.0.0-20230920030758-dbf443e27376 // indirect
mosn.io/layotto/spec v0.0.0-20240927030843-b4fed4d06be4 // indirect
)
9 changes: 5 additions & 4 deletions demo/state/k8s/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/layotto/go-sdk v0.0.0-20241113124402-e55ee5816d2f h1:xm1tsLV09M6if6AzHIb7PVMpGwNB9iEDwujcSNvxMtY=
github.com/layotto/go-sdk v0.0.0-20241113124402-e55ee5816d2f/go.mod h1:wsC0WVxh+E/n7WpsBL7KnHCfwWjcWLee9j73M4vtQ2c=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down Expand Up @@ -95,8 +97,7 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
mosn.io/layotto/sdk/go-sdk v0.0.0-20230920030758-dbf443e27376 h1:PXv6Ru2HC4Mqlj+KY5R1xqHPk8nwgJwiMxuHg1jMhZg=
mosn.io/layotto/sdk/go-sdk v0.0.0-20230920030758-dbf443e27376/go.mod h1:vfiOK6P29QD8Ti5NTeTfWamLN3EzrcCQD1tpldX4K3Y=
mosn.io/layotto/sdk/go-sdk v0.0.0-20240927030843-b4fed4d06be4/go.mod h1:vfiOK6P29QD8Ti5NTeTfWamLN3EzrcCQD1tpldX4K3Y=
mosn.io/layotto/spec v0.0.0-20210707123820-584778d048d3/go.mod h1:ex31WL9Vx1PadpZmN4CZpw/57xzBeKIwqMI5fYXi7RY=
mosn.io/layotto/spec v0.0.0-20230920030758-dbf443e27376 h1:Hku8GOHjTzjjqnG+5ka6ZnDoKXXN+smWpyi1iU87x+U=
mosn.io/layotto/spec v0.0.0-20230920030758-dbf443e27376/go.mod h1:3ri6wotzCp2LTjrCZ3Pfre+u1tw2b4Sc+qZERM7apwU=
mosn.io/layotto/spec v0.0.0-20240927030843-b4fed4d06be4 h1:4ThNPnPfpPzk32hUIm/mRm4+Ch4MmFNFbnFhbuZ4Qms=
mosn.io/layotto/spec v0.0.0-20240927030843-b4fed4d06be4/go.mod h1:3ri6wotzCp2LTjrCZ3Pfre+u1tw2b4Sc+qZERM7apwU=
8 changes: 0 additions & 8 deletions etc/script/report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,4 @@ echo "" > cover.out
echo "test components"
go test -count=1 -failfast -timeout 120s ./... -coverprofile cover.out -covermode=atomic
cat cover.out >> ../cover.out
cd ..


cd sdk/go-sdk
echo "" > cover.out
echo "test go-sdk"
go test -count=1 -failfast -timeout 120s $(go list ./... | grep -v runtime) -coverprofile cover.out -covermode=atomic
cat cover.out >> ../../cover.out
cd ../..
3 changes: 0 additions & 3 deletions make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ endif
ifeq ($(origin TEST_WASM_DIR),undefined)
TEST_WASM_DIR := $(ROOT_DIR)/test
endif
ifeq ($(origin TEST_RUNTIME_DIR),undefined)
TEST_RUNTIME_DIR := $(ROOT_DIR)/sdk/go-sdk/test
endif
ifeq ($(origin DEMO_DIR),undefined)
DEMO_DIR := $(ROOT_DIR)/demo
endif
Expand Down
3 changes: 0 additions & 3 deletions make/golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ go.lint: go.lint.verify
go.unittest:
@echo "===========> Run unit test in diagnostics" > $(UNITTEST_OUT) && \
$(GO) test -count=1 -timeout=10m -short -v `go list ./diagnostics/...` >> $(UNITTEST_OUT) && \
echo "===========> Run unit test in sdk/go-sdk" >> $(UNITTEST_OUT) && \
cd sdk/go-sdk && $(GO) test -count=1 -timeout=10m -short -v `go list ./... | grep -v runtime` >> $(UNITTEST_OUT) && \
echo "===========> Run unit test in components" >> $(UNITTEST_OUT) && \
cd ../../components && $(GO) test -count=1 -timeout=10m -short -v `go list ./...` >> $(UNITTEST_OUT) && \
echo "===========> Run unit test in pkg" >> $(UNITTEST_OUT) && \
Expand Down Expand Up @@ -199,5 +197,4 @@ go.format: go.format.verify
$(GO) mod tidy
cd components && $(GO) mod tidy
cd demo && $(GO) mod tidy
cd sdk/go-sdk && $(GO) mod tidy
cd spec && $(GO) mod tidy
1 change: 1 addition & 0 deletions pkg/mock/components/lock/lock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 576685d

Please sign in to comment.