Skip to content

Commit

Permalink
upgrade core and etcd, use latest
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Jun 18, 2021
1 parent d60bfe8 commit fc158da
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 500 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
ACTIONS_ALLOW_UNSECURE_COMMANDS: '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.31
version: v1.40
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
18 changes: 9 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ run:
skip-dirs:
- vendor
- tools
- 3rdmocks
modules-download-mode: readonly

issues:
exclude-rules:
- linters:
- staticcheck
text: "SA1019:"

linters-settings:
maligned:
suggest-new: true
Expand All @@ -31,18 +26,23 @@ linters:
- gocyclo
- gofmt
- goimports
- golint
# golint is replaced by revive
# - golint
- revive
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
# interfacer is deprecated
# - interfacer
- misspell
- nakedret
- nolintlint
- rowserrcheck
- scopelint
# scopelint is replaced by exportloopref
# - scopelint
- exportloopref
- staticcheck
- structcheck
- typecheck
Expand Down
2 changes: 1 addition & 1 deletion engine/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (e *Engine) attach(container *types.Container) {
Stderr: true,
}
resp, err := e.docker.ContainerAttach(ctx, container.ID, options)
if err != nil && err != httputil.ErrPersistEOF {
if err != nil && err != httputil.ErrPersistEOF { // nolint
log.Errorf("[attach] attach %s container %s failed %s", container.Name, coreutils.ShortID(container.ID), err)
return
}
Expand Down
15 changes: 8 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/projecteru2/agent

go 1.13
go 1.16

require (
github.com/CMGS/statsd v0.0.0-20160223095033-48c421b3c1ab
Expand All @@ -10,21 +10,22 @@ require (
github.com/docker/docker v20.10.0+incompatible
github.com/docker/go-units v0.4.0
github.com/go-ole/go-ole v0.0.0-20180213002836-a1ec82a652eb // indirect
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect
github.com/jinzhu/configor v1.2.1
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/projecteru2/core v0.0.0-20210609103900-b2f866c6991b
github.com/prometheus/client_golang v1.8.0
github.com/projecteru2/core v0.0.0-20210618045145-314d3a292929
github.com/prometheus/client_golang v1.11.0
github.com/sethvargo/go-signalcontext v0.1.0
github.com/shirou/gopsutil v3.20.11+incompatible
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/urfave/cli/v2 v2.3.0
go.etcd.io/etcd/v3 v3.3.0-rc.0.0.20200925060232-add86bbd1a7a
go.etcd.io/etcd/api/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0
go.opencensus.io v0.22.2 // indirect
go.uber.org/automaxprocs v1.3.0
google.golang.org/grpc v1.29.1
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c
google.golang.org/grpc v1.38.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
gotest.tools/v3 v3.0.3 // indirect
)
669 changes: 196 additions & 473 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions selfmon/selfmon.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
etcdtypes "go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/mvcc/mvccpb"
"go.etcd.io/etcd/api/v3/mvccpb"
etcdtypes "go.etcd.io/etcd/client/v3"

"github.com/projecteru2/agent/types"
"github.com/projecteru2/agent/utils"
Expand Down Expand Up @@ -44,7 +44,7 @@ func New(config *types.Config) (mon *Selfmon, err error) {
mon = &Selfmon{}
mon.config = config
mon.exit.C = make(chan struct{}, 1)
if mon.etcd, err = coremeta.NewETCD(config.Etcd, false); err != nil {
if mon.etcd, err = coremeta.NewETCD(config.Etcd, nil); err != nil {
return
}

Expand Down
7 changes: 2 additions & 5 deletions selfmon/selfmon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,10 @@ func newTestSelfmon(t *testing.T) (*Selfmon, func()) {
m.rpc = &mocks.CoreRPCClient{}

// Uses an embedded one instead of the real one.
m.etcd, err = coremeta.NewETCD(config.Etcd, true)
m.etcd, err = coremeta.NewETCD(config.Etcd, t)
require.NoError(t, err)

m.rpc.(*mocks.CoreRPCClient).On("NodeStatusStream", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("mock"))
m.rpc.(*mocks.CoreRPCClient).On("GetNodeStatus", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("mock"))
return m, func() {
m.etcd.TerminateEmbededStorage()
m.Close()
}
return m, m.Close
}
2 changes: 1 addition & 1 deletion utils/bufpipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (w *PipeWriter) Close() error {
return w.CloseWithError(nil)
}

// Close closes the writer
// CloseWithError closes the writer
func (w *PipeWriter) CloseWithError(err error) error {
w.cond.L.Lock()
defer w.cond.L.Unlock()
Expand Down

0 comments on commit fc158da

Please sign in to comment.