chore(deps): bump go-micro.dev/v4 from 4.10.2 to 4.11.0

Bumps [go-micro.dev/v4](https://github.com/go-micro/go-micro) from 4.10.2 to 4.11.0.
- [Release notes](https://github.com/go-micro/go-micro/releases)
- [Commits](https://github.com/go-micro/go-micro/compare/v4.10.2...v4.11.0)

---
updated-dependencies:
- dependency-name: go-micro.dev/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2024-07-08 10:03:51 +02:00
committed by Ralf Haferkamp
parent cb89e98f28
commit 50e24b0318
12 changed files with 71 additions and 36 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ require (
github.com/unrolled/secure v1.14.0
github.com/urfave/cli/v2 v2.27.2
github.com/xhit/go-simple-mail/v2 v2.16.0
go-micro.dev/v4 v4.10.2
go-micro.dev/v4 v4.11.0
go.etcd.io/bbolt v1.3.10
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0
go.opentelemetry.io/contrib/zpages v0.52.0
+2 -2
View File
@@ -2107,8 +2107,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go-micro.dev/v4 v4.10.2 h1:GWQf1+FcAiMf1yca3P09RNjB31Xtk0C5HiKHSpq/2qA=
go-micro.dev/v4 v4.10.2/go.mod h1:RV2AolXjTAil9Xm82QCMo1gknuZwD61oMUH14wJpECk=
go-micro.dev/v4 v4.11.0 h1:DZ2xcr0pnZJDlp6MJiCLhw4tXRxLw9xrJlPT91kubr0=
go-micro.dev/v4 v4.11.0/go.mod h1:eE/tD53n3KbVrzrWxKLxdkGw45Fg1qaNLWjpJMvIUF4=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0=
go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ=
+3 -5
View File
@@ -1,9 +1,7 @@
# Go Micro [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/go-micro.dev/v4?tab=doc) [![Go Report Card](https://goreportcard.com/badge/github.com/go-micro/go-micro)](https://goreportcard.com/report/github.com/go-micro/go-micro) [![Discord](https://dcbadge.vercel.app/api/server/qV3HvnEJfB?style=flat-square&theme=default-inverted)](https://discord.gg/qV3HvnEJfB)
# Go Micro [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/go-micro.dev/v4?tab=doc) [![Go Report Card](https://goreportcard.com/badge/github.com/go-micro/go-micro)](https://goreportcard.com/report/github.com/go-micro/go-micro)
Go Micro is a framework for distributed systems development.
Note: V5 is in development. Leave feedback in this [form](https://forms.gle/41gEWAcSgnf88GKt7)
## Overview
Go Micro provides the core requirements for distributed systems development including RPC and Event driven communication.
@@ -56,7 +54,7 @@ Go Micro abstracts away the details of distributed systems. Here are the main fe
To make use of Go Micro import it
```golang
import "go-micro.dev/v4
import "go-micro.dev/v4"
```
Define a handler (protobuf is optionally supported - see [example](https://github.com/go-micro/examples/blob/main/helloworld/main.go))
@@ -99,7 +97,7 @@ Optionally set fixed address
```golang
service := micro.NewService(
// set address
micro.Handle(":8080"),
micro.Address(":8080"),
)
```
+9
View File
@@ -19,6 +19,14 @@ func NewOptions(opts ...Option) Options {
return options
}
// WithAddress sets the address to listen
func WithAddress(addr string) Option {
return func(o *Options) error {
o.Address = addr
return nil
}
}
// WithRouter sets the router to use e.g static or registry.
func WithRouter(r router.Router) Option {
return func(o *Options) error {
@@ -35,3 +43,4 @@ func WithRegistry(r registry.Registry) Option {
return nil
}
}
+17 -11
View File
@@ -77,7 +77,13 @@ func (r *rpcClient) newCodec(contentType string) (codec.NewCodec, error) {
return nil, fmt.Errorf("unsupported Content-Type: %s", contentType)
}
func (r *rpcClient) call(ctx context.Context, node *registry.Node, req Request, resp interface{}, opts CallOptions) error {
func (r *rpcClient) call(
ctx context.Context,
node *registry.Node,
req Request,
resp interface{},
opts CallOptions,
) error {
address := node.Address
logger := r.Options().Logger
@@ -194,7 +200,7 @@ func (r *rpcClient) call(ctx context.Context, node *registry.Node, req Request,
return
}
// recv request
// recv response
if err := stream.Recv(resp); err != nil {
ch <- err
return
@@ -292,12 +298,6 @@ func (r *rpcClient) stream(ctx context.Context, node *registry.Node, req Request
r.codec = codec
}
releaseFunc := func(_ error) {
if err = c.Close(); err != nil {
logger.Log(log.ErrorLevel, err)
}
}
stream := &rpcStream{
id: id,
context: ctx,
@@ -308,7 +308,7 @@ func (r *rpcClient) stream(ctx context.Context, node *registry.Node, req Request
closed: make(chan bool),
// signal the end of stream,
sendEOS: true,
release: releaseFunc,
release: func(_ error) {},
}
// wait for error response
@@ -490,7 +490,10 @@ func (r *rpcClient) Call(ctx context.Context, request Request, response interfac
return merrors.InternalServerError("go.micro.client", "service %s: %s", service, err.Error())
}
return merrors.InternalServerError("go.micro.client", "error getting next %s node: %s", service, err.Error())
return merrors.InternalServerError("go.micro.client",
"error getting next %s node: %s",
service,
err.Error())
}
// make the call
@@ -586,7 +589,10 @@ func (r *rpcClient) Stream(ctx context.Context, request Request, opts ...CallOpt
return nil, merrors.InternalServerError("go.micro.client", "service %s: %s", service, err.Error())
}
return nil, merrors.InternalServerError("go.micro.client", "error getting next %s node: %s", service, err.Error())
return nil, merrors.InternalServerError("go.micro.client",
"error getting next %s node: %s",
service,
err.Error())
}
stream, err := r.stream(ctx, node, request, callOpts)
+8 -8
View File
@@ -2,14 +2,14 @@ package config
import (
"bytes"
"sync"
"time"
"fmt"
"go-micro.dev/v4/config/loader"
"go-micro.dev/v4/config/loader/memory"
"go-micro.dev/v4/config/reader"
"go-micro.dev/v4/config/reader/json"
"go-micro.dev/v4/config/source"
"sync"
"time"
)
type config struct {
@@ -40,7 +40,6 @@ func newConfig(opts ...Option) (Config, error) {
if !c.opts.WithWatcherDisabled {
go c.run()
}
return &c, nil
}
@@ -126,7 +125,8 @@ func (c *config) run() {
case <-done:
case <-c.exit:
}
w.Stop()
err := w.Stop()
fmt.Println(err.Error())
}()
// block watch
@@ -240,6 +240,9 @@ func (c *config) Bytes() []byte {
}
func (c *config) Load(sources ...source.Source) error {
c.Lock()
defer c.Unlock()
if err := c.opts.Loader.Load(sources...); err != nil {
return err
}
@@ -249,9 +252,6 @@ func (c *config) Load(sources ...source.Source) error {
return err
}
c.Lock()
defer c.Unlock()
c.snap = snap
vals, err := c.opts.Reader.Values(snap.ChangeSet)
if err != nil {
+2 -1
View File
@@ -163,9 +163,10 @@ func (m *memory) reload() error {
}
func (m *memory) update() {
m.RLock()
watchers := make([]*watcher, 0, m.watchers.Len())
m.RLock()
for e := m.watchers.Front(); e != nil; e = e.Next() {
watchers = append(watchers, e.Value.(*watcher))
}
+5 -2
View File
@@ -1,6 +1,7 @@
package events
import (
"context"
"time"
"go-micro.dev/v4/logger"
@@ -148,6 +149,8 @@ func WithTTL(d time.Duration) WriteOption {
type ReadOptions struct {
// Limit the number of results to return
Limit uint
// Context should contain all implementation specific options, using context.WithValue.
Context context.Context
// Offset the results by this number, useful for paginated queries
Offset uint
}
@@ -158,13 +161,13 @@ type ReadOption func(o *ReadOptions)
// ReadLimit sets the limit attribute on ReadOptions.
func ReadLimit(l uint) ReadOption {
return func(o *ReadOptions) {
o.Limit = 1
o.Limit = l
}
}
// ReadOffset sets the offset attribute on ReadOptions.
func ReadOffset(l uint) ReadOption {
return func(o *ReadOptions) {
o.Offset = 1
o.Offset = l
}
}
+1
View File
@@ -137,6 +137,7 @@ func (s *rpcServer) reSubscribe(config Options) error {
}
s.subscribers[sb] = []broker.Subscriber{sub}
s.router.Subscribe(sb)
}
return nil
+1
View File
@@ -549,6 +549,7 @@ func (router *router) ProcessMessage(ctx context.Context, msg Message) (err erro
subs, ok := router.subscribers[msg.Topic()]
router.su.RUnlock()
if !ok {
log.Warnf("Subscriber not found for topic %s", msg.Topic())
return nil
}
+21 -5
View File
@@ -35,8 +35,8 @@ func IsLocal(addr string) bool {
}
// Extract returns a valid IP address. If the address provided is a valid
// address, it will be returned directly. Otherwise the available interfaces
// be itterated over to find an IP address, prefferably private.
// address, it will be returned directly. Otherwise, the available interfaces
// will be iterated over to find an IP address, preferably private.
func Extract(addr string) (string, error) {
// if addr is already specified then it's directly returned
if len(addr) > 0 && (addr != "0.0.0.0" && addr != "[::]" && addr != "::") {
@@ -115,10 +115,12 @@ func IPs() []string {
return ipAddrs
}
// findIP will return the first private IP available in the list,
// if no private IP is available it will return a public IP if present.
// findIP will return the first private IP available in the list.
// If no private IP is available it will return the first public IP, if present.
// If no public IP is available, it will return the first loopback IP, if present.
func findIP(addresses []net.Addr) (net.IP, error) {
var publicIP net.IP
var localIP net.IP
for _, rawAddr := range addresses {
var ip net.IP
@@ -131,8 +133,17 @@ func findIP(addresses []net.Addr) (net.IP, error) {
continue
}
if ip.IsLoopback() {
if localIP == nil {
localIP = ip
}
continue
}
if !ip.IsPrivate() {
publicIP = ip
if publicIP == nil {
publicIP = ip
}
continue
}
@@ -145,5 +156,10 @@ func findIP(addresses []net.Addr) (net.IP, error) {
return publicIP, nil
}
// Return local IP
if len(localIP) > 0 {
return localIP, nil
}
return nil, ErrIPNotFound
}
+1 -1
View File
@@ -1913,7 +1913,7 @@ github.com/xrash/smetrics
# github.com/yashtewari/glob-intersection v0.2.0
## explicit; go 1.17
github.com/yashtewari/glob-intersection
# go-micro.dev/v4 v4.10.2
# go-micro.dev/v4 v4.11.0
## explicit; go 1.18
go-micro.dev/v4
go-micro.dev/v4/api