mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: remove os.Kill from signal.Notify
Clears SA1016 in staticcheck
This commit is contained in:
parent
d31701bab5
commit
7e05b33aa0
@ -18,6 +18,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
"github.com/coreos/etcd/clientv3/concurrency"
|
"github.com/coreos/etcd/clientv3/concurrency"
|
||||||
@ -73,7 +74,7 @@ func observe(c *clientv3.Client, election string) error {
|
|||||||
|
|
||||||
donec := make(chan struct{})
|
donec := make(chan struct{})
|
||||||
sigc := make(chan os.Signal, 1)
|
sigc := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigc, os.Interrupt, os.Kill)
|
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
|
||||||
go func() {
|
go func() {
|
||||||
<-sigc
|
<-sigc
|
||||||
cancel()
|
cancel()
|
||||||
@ -107,7 +108,7 @@ func campaign(c *clientv3.Client, election string, prop string) error {
|
|||||||
|
|
||||||
donec := make(chan struct{})
|
donec := make(chan struct{})
|
||||||
sigc := make(chan os.Signal, 1)
|
sigc := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigc, os.Interrupt, os.Kill)
|
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
|
||||||
go func() {
|
go func() {
|
||||||
<-sigc
|
<-sigc
|
||||||
cancel()
|
cancel()
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
"github.com/coreos/etcd/clientv3/concurrency"
|
"github.com/coreos/etcd/clientv3/concurrency"
|
||||||
@ -57,7 +58,7 @@ func lockUntilSignal(c *clientv3.Client, lockname string) error {
|
|||||||
// unlock in case of ordinary shutdown
|
// unlock in case of ordinary shutdown
|
||||||
donec := make(chan struct{})
|
donec := make(chan struct{})
|
||||||
sigc := make(chan os.Signal, 1)
|
sigc := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigc, os.Interrupt, os.Kill)
|
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
|
||||||
go func() {
|
go func() {
|
||||||
<-sigc
|
<-sigc
|
||||||
cancel()
|
cancel()
|
||||||
|
@ -29,7 +29,7 @@ func TestMain(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
notifier := make(chan os.Signal, 1)
|
notifier := make(chan os.Signal, 1)
|
||||||
signal.Notify(notifier, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL)
|
signal.Notify(notifier, syscall.SIGINT, syscall.SIGTERM)
|
||||||
go main()
|
go main()
|
||||||
<-notifier
|
<-notifier
|
||||||
}
|
}
|
||||||
|
2
test
2
test
@ -281,7 +281,7 @@ function fmt_pass {
|
|||||||
if [ -n "${staticcheckResult}" ]; then
|
if [ -n "${staticcheckResult}" ]; then
|
||||||
# TODO: resolve these after go1.8 migration
|
# TODO: resolve these after go1.8 migration
|
||||||
# See https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck
|
# See https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck
|
||||||
STATIC_CHECK_MASK="SA(1016|1019|2002)"
|
STATIC_CHECK_MASK="SA(1019|2002)"
|
||||||
if echo "${staticcheckResult}" | egrep -v "$STATIC_CHECK_MASK"; then
|
if echo "${staticcheckResult}" | egrep -v "$STATIC_CHECK_MASK"; then
|
||||||
echo -e "staticcheck checking ${path} failed:\n${staticcheckResult}"
|
echo -e "staticcheck checking ${path} failed:\n${staticcheckResult}"
|
||||||
exit 255
|
exit 255
|
||||||
|
Loading…
x
Reference in New Issue
Block a user