-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add golangci lint to github action workflow #1068
Changes from 1 commit
ec3a491
07ad3b7
8848eb1
a731041
4747a4e
9a3d0f8
26ad18a
15983e2
1445cc4
65e9614
ae74b8a
db1b606
be7ec3c
63392b8
34d4174
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ package httpproxy | |
|
||
import ( | ||
"net/http" | ||
"sync" | ||
"testing" | ||
|
||
"github.com/megaease/easegress/v2/pkg/context" | ||
|
@@ -93,7 +92,7 @@ servers: | |
assert.NoError(spec.Validate()) | ||
|
||
p := &Proxy{} | ||
p.super = supervisor.NewMock(option.New(), nil, sync.Map{}, sync.Map{}, nil, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
p.super = supervisor.NewMock(option.New(), nil, nil, | ||
nil, false, nil, nil) | ||
sp := NewServerPool(p, spec, "test") | ||
policies := map[string]resilience.Policy{} | ||
|
@@ -135,7 +134,7 @@ servers: | |
assert.NoError(spec.Validate()) | ||
|
||
p := &Proxy{} | ||
p.super = supervisor.NewMock(option.New(), nil, sync.Map{}, sync.Map{}, nil, | ||
p.super = supervisor.NewMock(option.New(), nil, nil, | ||
nil, false, nil, nil) | ||
sp := NewServerPool(p, spec, "test") | ||
spCtx := &serverPoolContext{ | ||
|
@@ -178,7 +177,7 @@ func TestCopyCORSHeaders(t *testing.T) { | |
dst.Add("X-Dst", "dst") | ||
|
||
p := &Proxy{} | ||
p.super = supervisor.NewMock(option.New(), nil, sync.Map{}, sync.Map{}, nil, | ||
p.super = supervisor.NewMock(option.New(), nil, nil, | ||
nil, false, nil, nil) | ||
sp := NewServerPool(p, &ServerPoolSpec{}, "test") | ||
dst = sp.mergeResponseHeader(dst, src) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,21 +71,16 @@ func NotifySigUsr2(closeCls func(), restartCls func()) error { | |
// Reset signal usr2 notify | ||
NotifySigUsr2(closeCls, restartCls) | ||
} else { | ||
childdone := make(chan error, 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant channel. |
||
go func() { | ||
process, err := os.FindProcess(pid) | ||
if err != nil { | ||
restartCls() | ||
NotifySigUsr2(closeCls, restartCls) | ||
} else { | ||
_, werr := process.Wait() | ||
childdone <- werr | ||
select { | ||
case err := <-childdone: | ||
logger.Errorf("child proc exited: %v", err) | ||
restartCls() | ||
NotifySigUsr2(closeCls, restartCls) | ||
} | ||
logger.Errorf("child proc exited: %v", werr) | ||
restartCls() | ||
NotifySigUsr2(closeCls, restartCls) | ||
} | ||
}() | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -751,10 +751,9 @@ type testServer struct { | |
|
||
func newServer(addr string) *testServer { | ||
mux := http.NewServeMux() | ||
srv := http.Server{Addr: addr, Handler: mux} | ||
ts := &testServer{ | ||
mux: mux, | ||
srv: srv, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copy lock. |
||
srv: http.Server{Addr: addr, Handler: mux}, | ||
addr: addr, | ||
} | ||
return ts | ||
|
@@ -1389,7 +1388,7 @@ func TestMQTTProxy(t *testing.T) { | |
name: mqtt-proxy | ||
kind: MQTTProxy | ||
` | ||
super := supervisor.NewMock(option.New(), nil, sync.Map{}, sync.Map{}, nil, nil, false, nil, nil) | ||
super := supervisor.NewMock(option.New(), nil, nil, nil, false, nil, nil) | ||
super.Options() | ||
superSpec, err := super.NewSpec(yamlStr) | ||
assert.Nil(err) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,26 +18,21 @@ | |
package supervisor | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/megaease/easegress/v2/pkg/cluster" | ||
"github.com/megaease/easegress/v2/pkg/option" | ||
) | ||
|
||
// NewMock return a mock supervisor for testing purpose | ||
func NewMock(options *option.Options, cls cluster.Cluster, businessControllers sync.Map, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
systemControllers sync.Map, objectRegistry *ObjectRegistry, watcher *ObjectEntityWatcher, | ||
func NewMock(options *option.Options, cls cluster.Cluster, objectRegistry *ObjectRegistry, watcher *ObjectEntityWatcher, | ||
firstHandle bool, firstHandleDone chan struct{}, done chan struct{}) *Supervisor { | ||
return &Supervisor{ | ||
options: options, | ||
cls: cls, | ||
businessControllers: businessControllers, | ||
systemControllers: systemControllers, | ||
objectRegistry: objectRegistry, | ||
watcher: watcher, | ||
firstHandle: firstHandle, | ||
firstHandleDone: firstHandleDone, | ||
done: done, | ||
options: options, | ||
cls: cls, | ||
objectRegistry: objectRegistry, | ||
watcher: watcher, | ||
firstHandle: firstHandle, | ||
firstHandleDone: firstHandleDone, | ||
done: done, | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sync.Map
contains lock, can't be copy.