Skip to content

Commit

Permalink
Merge pull request #49 from Scalingo/deps/etcd/3.5.0
Browse files Browse the repository at this point in the history
Bump etcd client to 3.5.0 (v2.305.0) and also bump to Go 1.16
  • Loading branch information
brandon-welsch authored Jul 28, 2021
2 parents 0629446 + 8b85866 commit 68c6a91
Show file tree
Hide file tree
Showing 18 changed files with 166 additions and 187 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
*.test
.*swp
*~
Godeps/_workspace

# IDE
.idea/
.vscode/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## To Be Released

* Bump etcd client to 3.5.0 (v2.305.0) and also bump to Go 1.16
[#49](https://github.com/Scalingo/etcd-discovery/pull/49)
* Bump github.com/golang/mock from 1.4.4 to 1.6.0
[#46](https://github.com/Scalingo/etcd-discovery/pull/46)
and [#47](https://github.com/Scalingo/etcd-discovery/pull/47)

## v7.0.3

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Etcd Discovery v7.0.3

This is a golang package for managing services over the decentralized key-value store etcd
This is a golang package for managing services over the decentralized key-value store etcd.

> http://github.com/coreos/etcd
> https://github.com/etcd-io/etcd
To install it:

Expand Down Expand Up @@ -110,7 +110,7 @@ Generate the mocks with:
```shell
for interface in $(grep --extended-regexp --no-message --no-filename "type .* interface" ./service/* | cut -d " " -f 2)
do
mockgen -destination service/servicemock/gomock_$(echo $interface | tr '[:upper:]' '[:lower:]').go -package servicemock github.com/Scalingo/etcd-discovery/service $interface
mockgen -destination service/servicemock/gomock_$(echo $interface | tr '[:upper:]' '[:lower:]').go -package servicemock github.com/Scalingo/etcd-discovery/v7/service $interface
done
```

Expand Down
16 changes: 10 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
module github.com/Scalingo/etcd-discovery/v7

go 1.15
go 1.16

require (
github.com/coreos/go-semver v0.3.0 // indirect
github.com/gofrs/uuid v3.4.0+incompatible
github.com/golang/mock v1.6.0
github.com/json-iterator/go v1.1.10 // indirect
github.com/smartystreets/goconvey v1.6.4
go.etcd.io/etcd/v3 v3.3.0-rc.0.0.20200826232710-c20cc05fc548
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
go.etcd.io/etcd/client/pkg/v3 v3.5.0
// The latest versions of etcd have been migrated to go modules.
// Since this change the version of the etcd client we are currently
// using in this package has been named v2.
// This does not mean that it does not work with the etcd server version 3.
//
// The package "go.etcd.io/etcd/client/v3" is a complete refactoring
// of the client and uses grpc instead of http, that we currently use.
go.etcd.io/etcd/client/v2 v2.305.0
gopkg.in/errgo.v1 v1.0.1
)
244 changes: 94 additions & 150 deletions go.sum

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions service/get.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package service

import (
etcd "go.etcd.io/etcd/v3/client"
"golang.org/x/net/context"
errgo "gopkg.in/errgo.v1"
"context"

etcd "go.etcd.io/etcd/client/v2"
"gopkg.in/errgo.v1"
)

// ServiceResponse is the interface used to provide a response to the service.Get() Method.
Expand Down
2 changes: 1 addition & 1 deletion service/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

errgo "gopkg.in/errgo.v1"
"gopkg.in/errgo.v1"
)

// Ports is a representation of the ports exposed by a host or a service.
Expand Down
4 changes: 2 additions & 2 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"sync"
"time"

etcd "go.etcd.io/etcd/v3/client"
"go.etcd.io/etcd/v3/pkg/transport"
"go.etcd.io/etcd/client/pkg/v3/transport"
etcd "go.etcd.io/etcd/client/v2"
)

var (
Expand Down
5 changes: 2 additions & 3 deletions service/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package service
import (
"encoding/json"

errgo "gopkg.in/errgo.v1"

etcd "go.etcd.io/etcd/v3/client"
etcd "go.etcd.io/etcd/client/v2"
"gopkg.in/errgo.v1"
)

func buildHostsFromNodes(nodes etcd.Nodes) (Hosts, error) {
Expand Down
2 changes: 1 addition & 1 deletion service/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package service
import (
"testing"

etcd "go.etcd.io/etcd/v3/client"
. "github.com/smartystreets/goconvey/convey"
etcd "go.etcd.io/etcd/client/v2"
)

var (
Expand Down
12 changes: 5 additions & 7 deletions service/register.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package service

import (
"context"
"encoding/json"
"fmt"
"time"

errgo "gopkg.in/errgo.v1"

etcd "go.etcd.io/etcd/v3/client"
"github.com/gofrs/uuid"
"golang.org/x/net/context"
etcd "go.etcd.io/etcd/client/v2"
"gopkg.in/errgo.v1"
)

const (
Expand Down Expand Up @@ -39,9 +38,8 @@ func Register(ctx context.Context, service string, host Host) *Registration {
host.PrivatePorts = host.Ports
}

uuid, _ := uuid.NewV4()

hostUuid := fmt.Sprintf("%s-%s", uuid.String(), host.PrivateHostname)
uuidV4, _ := uuid.NewV4()
hostUuid := fmt.Sprintf("%s-%s", uuidV4.String(), host.PrivateHostname)
host.UUID = hostUuid

serviceInfos := &Service{
Expand Down
4 changes: 2 additions & 2 deletions service/register_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package service

import (
"context"
"encoding/json"
"fmt"
"path"
"testing"
"time"

etcd "go.etcd.io/etcd/v3/client"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
etcd "go.etcd.io/etcd/client/v2"
)

func TestRegister(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"math/rand"

etcd "go.etcd.io/etcd/v3/client"
errgo "gopkg.in/errgo.v1"
etcd "go.etcd.io/etcd/client/v2"
"gopkg.in/errgo.v1"
)

// Service store all the informatiosn about a service. This is also used to marshal services present in the /services_infos/ directory.
Expand Down
8 changes: 8 additions & 0 deletions service/servicemock/gomock_hostresponse.go

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

8 changes: 8 additions & 0 deletions service/servicemock/gomock_registrationwrapper.go

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

12 changes: 12 additions & 0 deletions service/servicemock/gomock_serviceresponse.go

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

5 changes: 2 additions & 3 deletions service/subscribe.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package service

import (
"context"
"path"

"golang.org/x/net/context"

etcd "go.etcd.io/etcd/v3/client"
etcd "go.etcd.io/etcd/client/v2"
)

// Subscribe to every event that happen to a service
Expand Down
Loading

0 comments on commit 68c6a91

Please sign in to comment.