未验证 提交 563768b5 编写于 作者: A Asim Aslam 提交者: GitHub

v3 refactor (#1868)

* Move to v3
Co-authored-by: NBen Toogood <bentoogood@gmail.com>
上级 9dfeb981
name: Build all github.com/micro/examples
on:
pull_request:
branches:
- master
jobs:
build:
name: Build repos
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Install Protoc
uses: arduino/setup-protoc@master
- name: Check out this code
uses: actions/checkout@v2
with:
path: 'go-micro'
- name: Check out code examples
uses: actions/checkout@v2
with:
repository: 'micro/examples'
path: 'examples'
- name: Build all
run: $GITHUB_WORKSPACE/go-micro/.github/workflows/scripts/build-all-examples.sh ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.head.repo.full_name }}
working-directory: examples
\ No newline at end of file
name: Build and test micro
on:
pull_request:
branches:
- master
jobs:
build:
name: Build and test micro
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v2
with:
go-version: 1.13
id: go
- name: Install Protoc
uses: arduino/setup-protoc@master
- name: Check out this code
uses: actions/checkout@v2
with:
path: 'go-micro'
- name: Check out micro
uses: actions/checkout@v2
with:
repository: 'micro/micro'
path: 'micro'
- name: Build all
run: $GITHUB_WORKSPACE/go-micro/.github/workflows/scripts/build-micro.sh ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.head.repo.full_name }}
working-directory: micro
\ No newline at end of file
......@@ -6,8 +6,8 @@ import (
"sync"
"github.com/bwmarrin/discordgo"
"github.com/micro/go-micro/v2/agent/input"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v3/agent/input"
"github.com/micro/go-micro/v3/logger"
)
type discordConn struct {
......
......@@ -9,7 +9,7 @@ import (
"github.com/bwmarrin/discordgo"
"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/agent/input"
"github.com/micro/go-micro/v3/agent/input"
)
func init() {
......
......@@ -7,7 +7,7 @@ import (
"sync"
"time"
"github.com/micro/go-micro/v2/agent/input"
"github.com/micro/go-micro/v3/agent/input"
"github.com/nlopes/slack"
)
......
......@@ -5,7 +5,7 @@ import (
"sync"
"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/agent/input"
"github.com/micro/go-micro/v3/agent/input"
"github.com/nlopes/slack"
)
......
......@@ -6,8 +6,8 @@ import (
"sync"
"github.com/forestgiant/sliceutil"
"github.com/micro/go-micro/v2/agent/input"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v3/agent/input"
"github.com/micro/go-micro/v3/logger"
tgbotapi "gopkg.in/telegram-bot-api.v4"
)
......
......@@ -6,7 +6,7 @@ import (
"sync"
"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/agent/input"
"github.com/micro/go-micro/v3/agent/input"
tgbotapi "gopkg.in/telegram-bot-api.v4"
)
......
......@@ -11,9 +11,9 @@ import (
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
api "github.com/micro/go-micro/v3/api"
client "github.com/micro/go-micro/v3/client"
server "github.com/micro/go-micro/v3/server"
)
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -5,8 +5,8 @@ import (
"regexp"
"strings"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v2/server"
"github.com/micro/go-micro/v3/registry"
"github.com/micro/go-micro/v3/server"
)
type Api interface {
......
......@@ -4,13 +4,13 @@ package api
import (
"net/http"
goapi "github.com/micro/go-micro/v2/api"
"github.com/micro/go-micro/v2/api/handler"
"github.com/micro/go-micro/v2/api/handler/util"
api "github.com/micro/go-micro/v2/api/proto"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/errors"
"github.com/micro/go-micro/v2/util/ctx"
goapi "github.com/micro/go-micro/v3/api"
"github.com/micro/go-micro/v3/api/handler"
"github.com/micro/go-micro/v3/api/handler/util"
api "github.com/micro/go-micro/v3/api/proto"
"github.com/micro/go-micro/v3/client"
"github.com/micro/go-micro/v3/errors"
"github.com/micro/go-micro/v3/util/ctx"
)
type apiHandler struct {
......
......@@ -7,7 +7,7 @@ import (
"net/http"
"strings"
api "github.com/micro/go-micro/v2/api/proto"
api "github.com/micro/go-micro/v3/api/proto"
"github.com/oxtoacart/bpool"
)
......
......@@ -11,9 +11,9 @@ import (
"time"
"github.com/google/uuid"
"github.com/micro/go-micro/v2/api/handler"
proto "github.com/micro/go-micro/v2/api/proto"
"github.com/micro/go-micro/v2/util/ctx"
"github.com/micro/go-micro/v3/api/handler"
proto "github.com/micro/go-micro/v3/api/proto"
"github.com/micro/go-micro/v3/util/ctx"
"github.com/oxtoacart/bpool"
)
......
......@@ -9,9 +9,9 @@ import (
"net/http/httputil"
"net/url"
"github.com/micro/go-micro/v2/api"
"github.com/micro/go-micro/v2/api/handler"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v3/api"
"github.com/micro/go-micro/v3/api/handler"
"github.com/micro/go-micro/v3/registry"
)
const (
......
......@@ -6,13 +6,13 @@ import (
"net/http/httptest"
"testing"
"github.com/micro/go-micro/v2/api/handler"
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v2/api/resolver/vpath"
"github.com/micro/go-micro/v2/api/router"
regRouter "github.com/micro/go-micro/v2/api/router/registry"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v2/registry/memory"
"github.com/micro/go-micro/v3/api/handler"
"github.com/micro/go-micro/v3/api/resolver"
"github.com/micro/go-micro/v3/api/resolver/vpath"
"github.com/micro/go-micro/v3/api/router"
regRouter "github.com/micro/go-micro/v3/api/router/registry"
"github.com/micro/go-micro/v3/registry"
"github.com/micro/go-micro/v3/registry/memory"
)
func testHttp(t *testing.T, path, service, ns string) {
......
package handler
import (
"github.com/micro/go-micro/v2/api/router"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client/grpc"
"github.com/micro/go-micro/v3/api/router"
"github.com/micro/go-micro/v3/client"
"github.com/micro/go-micro/v3/client/grpc"
)
var (
......
......@@ -9,19 +9,19 @@ import (
"strings"
jsonpatch "github.com/evanphx/json-patch/v5"
"github.com/micro/go-micro/v2/api"
"github.com/micro/go-micro/v2/api/handler"
"github.com/micro/go-micro/v2/api/handler/util"
"github.com/micro/go-micro/v2/api/internal/proto"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/codec"
"github.com/micro/go-micro/v2/codec/jsonrpc"
"github.com/micro/go-micro/v2/codec/protorpc"
"github.com/micro/go-micro/v2/errors"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v2/metadata"
"github.com/micro/go-micro/v2/util/ctx"
"github.com/micro/go-micro/v2/util/qson"
"github.com/micro/go-micro/v3/api"
"github.com/micro/go-micro/v3/api/handler"
"github.com/micro/go-micro/v3/api/handler/util"
"github.com/micro/go-micro/v3/api/internal/proto"
"github.com/micro/go-micro/v3/client"
"github.com/micro/go-micro/v3/codec"
"github.com/micro/go-micro/v3/codec/jsonrpc"
"github.com/micro/go-micro/v3/codec/protorpc"
"github.com/micro/go-micro/v3/errors"
"github.com/micro/go-micro/v3/logger"
"github.com/micro/go-micro/v3/metadata"
"github.com/micro/go-micro/v3/util/ctx"
"github.com/micro/go-micro/v3/util/qson"
"github.com/oxtoacart/bpool"
)
......
......@@ -7,7 +7,7 @@ import (
"testing"
"github.com/golang/protobuf/proto"
go_api "github.com/micro/go-micro/v2/api/proto"
go_api "github.com/micro/go-micro/v3/api/proto"
)
func TestRequestPayloadFromRequest(t *testing.T) {
......
......@@ -12,11 +12,11 @@ import (
"github.com/gobwas/httphead"
"github.com/gobwas/ws"
"github.com/gobwas/ws/wsutil"
"github.com/micro/go-micro/v2/api"
"github.com/micro/go-micro/v2/api/handler/util"
"github.com/micro/go-micro/v2/client"
raw "github.com/micro/go-micro/v2/codec/bytes"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v3/api"
"github.com/micro/go-micro/v3/api/handler/util"
"github.com/micro/go-micro/v3/client"
raw "github.com/micro/go-micro/v3/codec/bytes"
"github.com/micro/go-micro/v3/logger"
)
// serveWebsocket will stream rpc back over websockets assuming json
......
package util
import (
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v2/router"
"github.com/micro/go-micro/v3/registry"
"github.com/micro/go-micro/v3/router"
)
// Router is a hack for API routing
......
......@@ -12,9 +12,9 @@ import (
"net/url"
"strings"
"github.com/micro/go-micro/v2/api"
"github.com/micro/go-micro/v2/api/handler"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v3/api"
"github.com/micro/go-micro/v3/api/handler"
"github.com/micro/go-micro/v3/registry"
)
const (
......
......@@ -6,7 +6,7 @@ import (
"net/http"
"strings"
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v3/api/resolver"
)
type Resolver struct {
......
......@@ -4,7 +4,7 @@ package host
import (
"net/http"
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v3/api/resolver"
)
type Resolver struct {
......
package resolver
import (
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v3/registry"
)
type Options struct {
......
......@@ -5,7 +5,7 @@ import (
"net/http"
"strings"
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v3/api/resolver"
)
type Resolver struct {
......
......@@ -7,8 +7,8 @@ import (
"net/http"
"strings"
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v3/api/resolver"
"github.com/micro/go-micro/v3/logger"
"golang.org/x/net/publicsuffix"
)
......
......@@ -5,7 +5,7 @@ import (
"net/url"
"testing"
"github.com/micro/go-micro/v2/api/resolver/vpath"
"github.com/micro/go-micro/v3/api/resolver/vpath"
"github.com/stretchr/testify/assert"
)
......
......@@ -7,7 +7,7 @@ import (
"regexp"
"strings"
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v3/api/resolver"
)
func NewResolver(opts ...resolver.Option) resolver.Resolver {
......
package router
import (
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v2/api/resolver/vpath"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v3/api/resolver"
"github.com/micro/go-micro/v3/api/resolver/vpath"
"github.com/micro/go-micro/v3/registry"
"github.com/micro/go-micro/v3/registry/mdns"
)
type Options struct {
......@@ -17,7 +18,7 @@ type Option func(o *Options)
func NewOptions(opts ...Option) Options {
options := Options{
Handler: "meta",
Registry: registry.DefaultRegistry,
Registry: mdns.NewRegistry(),
}
for _, o := range opts {
......
......@@ -10,13 +10,13 @@ import (
"sync"
"time"
"github.com/micro/go-micro/v2/api"
"github.com/micro/go-micro/v2/api/router"
"github.com/micro/go-micro/v2/api/router/util"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v2/metadata"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v2/registry/cache"
"github.com/micro/go-micro/v3/api"
"github.com/micro/go-micro/v3/api/router"
"github.com/micro/go-micro/v3/api/router/util"
"github.com/micro/go-micro/v3/logger"
"github.com/micro/go-micro/v3/metadata"
"github.com/micro/go-micro/v3/registry"
"github.com/micro/go-micro/v3/registry/cache"
)
// endpoint struct, that holds compiled pcre
......
......@@ -3,7 +3,7 @@ package registry
import (
"testing"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v3/registry"
"github.com/stretchr/testify/assert"
)
......
......@@ -4,7 +4,7 @@ package router
import (
"net/http"
"github.com/micro/go-micro/v2/api"
"github.com/micro/go-micro/v3/api"
)
// Router is used to determine an endpoint for a request
......