Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: unistack-org/micro
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.3.16
Choose a base ref
...
head repository: unistack-org/micro
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.3.17
Choose a head ref
  • 10 commits
  • 91 files changed
  • 2 contributors

Commits on Apr 20, 2021

  1. Copy the full SHA
    3b416ff View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5b6f849 View commit details

Commits on Apr 21, 2021

  1. store: remove unused Value type

    Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
    vtolstov committed Apr 21, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1f8b0ae View commit details

Commits on Apr 22, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    89b0565 View commit details

Commits on Apr 23, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    bae3b0e View commit details

Commits on Apr 26, 2021

  1. fixup

    Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
    vtolstov committed Apr 26, 2021
    Copy the full SHA
    00a4785 View commit details
  2. fieldaligment

    Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
    vtolstov committed Apr 26, 2021
    Copy the full SHA
    6dfdff7 View commit details
  3. meter: fix labels

    Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
    vtolstov committed Apr 26, 2021
    Copy the full SHA
    3bdfdd8 View commit details
  4. fieldaligment

    Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
    vtolstov committed Apr 26, 2021
    Copy the full SHA
    ee11f39 View commit details

Commits on Apr 27, 2021

  1. fieldalignment of all structs to save memory

    Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
    vtolstov committed Apr 27, 2021
    Copy the full SHA
    86626c5 View commit details
Showing with 430 additions and 534 deletions.
  1. +1 −2 .github/workflows/build.yml
  2. +1 −2 .github/workflows/pr.yml
  3. +35 −21 .golangci.yml
  4. +0 −1 api/api_test.go
  5. +2 −4 api/handler/options.go
  6. +2 −2 api/resolver/subdomain/subdomain.go
  7. +1 −3 api/resolver/vpath/vpath.go
  8. +2 −4 api/router/router.go
  9. +3 −3 auth/rules_test.go
  10. +2 −4 broker/broker.go
  11. +3 −3 broker/memory.go
  12. +4 −10 client/noop.go
  13. +9 −9 client/options.go
  14. +2 −2 client/test_request.go
  15. +1 −2 codec/noop.go
  16. +4 −6 config/config.go
  17. +9 −9 config/default.go
  18. +5 −5 config/default_test.go
  19. +1 −1 config/reflect_test.go
  20. +0 −2 errors/errors_test.go
  21. +2 −2 flow/dag_test.go
  22. +12 −2 flow/flow.go
  23. +1 −1 go.mod
  24. +3 −3 go.sum
  25. +1 −1 logger/micro.go
  26. +1 −1 logger/options.go
  27. +22 −20 logger/wrapper/wrapper.go
  28. +5 −3 metadata/context.go
  29. +4 −8 metadata/metadata.go
  30. +1 −3 metadata/metadata_test.go
  31. +7 −9 meter/handler/handler.go
  32. +6 −6 meter/meter.go
  33. +1 −1 meter/meter_test.go
  34. +13 −49 meter/noop.go
  35. +1 −1 meter/options.go
  36. +42 −42 meter/wrapper/wrapper.go
  37. +3 −3 network/transport/memory.go
  38. +2 −3 network/transport/memory_test.go
  39. +6 −4 network/tunnel/broker/broker.go
  40. +6 −6 network/tunnel/options.go
  41. +2 −3 network/tunnel/transport/transport.go
  42. +2 −4 network/tunnel/tunnel.go
  43. +2 −4 options.go
  44. +2 −4 profiler/http/http.go
  45. +2 −4 profiler/profile.go
  46. +2 −4 proxy/proxy.go
  47. +17 −18 register/memory.go
  48. +52 −54 register/memory_test.go
  49. +5 −0 register/options.go
  50. +2 −1 register/register.go
  51. +2 −2 register/watcher.go
  52. +4 −6 router/watcher.go
  53. +2 −4 runtime/runtime.go
  54. +2 −4 selector/selector.go
  55. +1 −1 server/handler.go
  56. +10 −15 server/health/health.go
  57. +20 −28 server/noop.go
  58. +6 −6 server/options.go
  59. +1 −1 server/registry.go
  60. +4 −6 server/server.go
  61. +8 −9 server/subscriber.go
  62. +0 −1 service.go
  63. +1 −1 store/memory.go
  64. +0 −11 store/store.go
  65. +1 −1 sync/memory.go
  66. +2 −4 sync/sync.go
  67. +0 −3 tracer/noop.go
  68. +2 −4 tracer/options.go
  69. +2 −4 tracer/tracer.go
  70. +8 −6 tracer/wrapper/wrapper.go
  71. +1 −3 util/addr/addr.go
  72. +0 −1 util/addr/addr_test.go
  73. +4 −4 util/buf/buf.go
  74. +0 −1 util/net/net.go
  75. +0 −1 util/net/net_test.go
  76. +3 −4 util/pki/pki.go
  77. +1 −3 util/qson/qson.go
  78. +2 −1 util/qson/qson_test.go
  79. +2 −2 util/rand/rand.go
  80. +0 −1 util/reflect/path_test.go
  81. +5 −11 util/reflect/struct.go
  82. +3 −3 util/reflect/struct_test.go
  83. +5 −5 util/register/util.go
  84. +5 −5 util/register/util_test.go
  85. +1 −1 util/router/compile.go
  86. +1 −3 util/router/parse.go
  87. +2 −1 util/router/parse_test.go
  88. +1 −1 util/sync/manager.go
  89. +2 −4 util/token/basic/basic.go
  90. +0 −1 util/token/jwt/jwt_test.go
  91. +2 −2 util/token/options.go
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -50,10 +50,9 @@ jobs:
uses: actions/checkout@v2
- name: lint
uses: golangci/golangci-lint-action@v2
continue-on-error: true
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.30
version: v1.39
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
3 changes: 1 addition & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -50,10 +50,9 @@ jobs:
uses: actions/checkout@v2
- name: lint
uses: golangci/golangci-lint-action@v2
continue-on-error: true
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.30
version: v1.39
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
56 changes: 35 additions & 21 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
run:
concurrency: 4
deadline: 5m
modules-download-mode: readonly
skip-files:
- ".*\\.pb\\.go$"
- ".*\\.pb\\.micro\\.go$"
issues-exit-code: 1
tests: true

linters-settings:
govet:
check-shadowing: true
enable:
- fieldalignment

linters:
disable-all: false
enable-all: false
enable:
- megacheck
- staticcheck
- govet
- deadcode
- varcheck
- gosimple
- errcheck
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- prealloc
- scopelint
- varcheck
- bodyclose
- gci
- goconst
- gocritic
- gosimple
- gofmt
- gofumpt
- goimports
- unconvert
- govet
- nakedret
- structcheck
- golint
- gosec
disable:
- maligned
- interfacer
- typecheck
- dupl
- makezero
- misspell
- nakedret
- nestif
- nilerr
- noctx
- prealloc
- unconvert
- unparam
disable-all: false
1 change: 0 additions & 1 deletion api/api_test.go
Original file line number Diff line number Diff line change
@@ -149,5 +149,4 @@ func TestValidate(t *testing.T) {
if err := Validate(epPcreInvalid); err == nil {
t.Fatalf("invalid pcre %v", epPcreInvalid.Path[0])
}

}
6 changes: 2 additions & 4 deletions api/handler/options.go
Original file line number Diff line number Diff line change
@@ -6,10 +6,8 @@ import (
"github.com/unistack-org/micro/v3/logger"
)

var (
// DefaultMaxRecvSize specifies max recv size for handler
DefaultMaxRecvSize int64 = 1024 * 1024 * 100 // 10Mb
)
// DefaultMaxRecvSize specifies max recv size for handler
var DefaultMaxRecvSize int64 = 1024 * 1024 * 100 // 10Mb

// Options struct holds handler options
type Options struct {
4 changes: 2 additions & 2 deletions api/resolver/subdomain/subdomain.go
Original file line number Diff line number Diff line change
@@ -15,12 +15,12 @@ import (
// NewResolver creates new subdomain api resolver
func NewResolver(parent resolver.Resolver, opts ...resolver.Option) resolver.Resolver {
options := resolver.NewOptions(opts...)
return &subdomainResolver{options, parent}
return &subdomainResolver{opts: options, Resolver: parent}
}

type subdomainResolver struct {
opts resolver.Options
resolver.Resolver
opts resolver.Options
}

// Resolve resolve endpoint based on subdomain
4 changes: 1 addition & 3 deletions api/resolver/vpath/vpath.go
Original file line number Diff line number Diff line change
@@ -19,9 +19,7 @@ type vpathResolver struct {
opts resolver.Options
}

var (
re = regexp.MustCompile("^v[0-9]+$")
)
var re = regexp.MustCompile("^v[0-9]+$")

// Resolve endpoint
func (r *vpathResolver) Resolve(req *http.Request, opts ...resolver.ResolveOption) (*resolver.Endpoint, error) {
6 changes: 2 additions & 4 deletions api/router/router.go
Original file line number Diff line number Diff line change
@@ -7,10 +7,8 @@ import (
"github.com/unistack-org/micro/v3/api"
)

var (
// DefaultRouter contains default router implementation
DefaultRouter Router
)
// DefaultRouter contains default router implementation
var DefaultRouter Router

// Router is used to determine an endpoint for a request
type Router interface {
6 changes: 3 additions & 3 deletions auth/rules_test.go
Original file line number Diff line number Diff line change
@@ -24,11 +24,11 @@ func TestVerify(t *testing.T) {
}

tt := []struct {
Name string
Rules []*Rule
Error error
Account *Account
Resource *Resource
Error error
Name string
Rules []*Rule
}{
{
Name: "NoRules",
6 changes: 2 additions & 4 deletions broker/broker.go
Original file line number Diff line number Diff line change
@@ -7,10 +7,8 @@ import (
"github.com/unistack-org/micro/v3/metadata"
)

var (
// DefaultBroker default broker
DefaultBroker Broker = NewBroker()
)
// DefaultBroker default broker
var DefaultBroker Broker = NewBroker()

// Broker is an interface used for asynchronous messaging.
type Broker interface {
6 changes: 3 additions & 3 deletions broker/memory.go
Original file line number Diff line number Diff line change
@@ -13,27 +13,27 @@ import (
)

type memoryBroker struct {
opts Options
Subscribers map[string][]*memorySubscriber
addr string
opts Options
sync.RWMutex
connected bool
}

type memoryEvent struct {
opts Options
err error
message interface{}
topic string
opts Options
}

type memorySubscriber struct {
opts SubscribeOptions
ctx context.Context
exit chan bool
handler Handler
id string
topic string
opts SubscribeOptions
}

func (m *memoryBroker) Options() Options {
14 changes: 4 additions & 10 deletions client/noop.go
Original file line number Diff line number Diff line change
@@ -9,16 +9,10 @@ import (
"github.com/unistack-org/micro/v3/metadata"
)

var (
// DefaultCodecs will be used to encode/decode data
DefaultCodecs = map[string]codec.Codec{
//"application/json": cjson.NewCodec,
//"application/json-rpc": cjsonrpc.NewCodec,
//"application/protobuf": cproto.NewCodec,
//"application/proto-rpc": cprotorpc.NewCodec,
"application/octet-stream": codec.NewCodec(),
}
)
// DefaultCodecs will be used to encode/decode data
var DefaultCodecs = map[string]codec.Codec{
"application/octet-stream": codec.NewCodec(),
}

type noopClient struct {
opts Options
18 changes: 9 additions & 9 deletions client/options.go
Original file line number Diff line number Diff line change
@@ -19,8 +19,8 @@ import (

// Options holds client options
type Options struct {
// CallOptions contains default CallOptions
CallOptions CallOptions
// Selector used to select needed address
Selector selector.Selector
// Logger used to log messages
Logger logger.Logger
// Tracer used for tracing
@@ -31,30 +31,30 @@ type Options struct {
Meter meter.Meter
// Router used to get route
Router router.Router
// Selector used to select needed address
Selector selector.Selector
// Transport used for transfer messages
Transport transport.Transport
// Context is used for external options
Context context.Context
// Codecs map
Codecs map[string]codec.Codec
// Lookup func used to get destination addr
Lookup LookupFunc
// Codecs map
Codecs map[string]codec.Codec
// TLSConfig specifies tls.Config for secure connection
TLSConfig *tls.Config
// Proxy is used for proxy requests
Proxy string
// ContentType is Used to select codec
// ContentType is used to select codec
ContentType string
// Name is the client name
Name string
// Wrappers contains wrappers
Wrappers []Wrapper
// CallOptions contains default CallOptions
CallOptions CallOptions
// PoolSize connection pool size
PoolSize int
// PoolTTL connection pool ttl
PoolTTL time.Duration
// TLSConfig specifies tls.Config for secure connection
TLSConfig *tls.Config
}

// NewCallOptions creates new call options struct
4 changes: 2 additions & 2 deletions client/test_request.go
Original file line number Diff line number Diff line change
@@ -5,13 +5,13 @@ import (
)

type testRequest struct {
opts RequestOptions
codec codec.Codec
body interface{}
service string
method string
endpoint string
contentType string
service string
opts RequestOptions
}

func (r *testRequest) ContentType() string {
3 changes: 1 addition & 2 deletions codec/noop.go
Original file line number Diff line number Diff line change
@@ -5,8 +5,7 @@ import (
"io"
)

type noopCodec struct {
}
type noopCodec struct{}

func (c *noopCodec) ReadHeader(conn io.Reader, m *Message, t MessageType) error {
return nil
10 changes: 4 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -6,10 +6,8 @@ import (
"errors"
)

var (
// DefaultConfig default config
DefaultConfig Config = NewConfig()
)
// DefaultConfig default config
var DefaultConfig Config = NewConfig()

var (
// ErrCodecMissing is returned when codec needed and not specified
@@ -37,10 +35,10 @@ type Config interface {
}

// Watcher is the config watcher
//type Watcher interface {
// type Watcher interface {
// Next() (, error)
// Stop() error
//}
// }

// Load loads config from config sources
func Load(ctx context.Context, cs ...Config) error {
Loading