Skip to content

Commit 7e05b33

Browse files
author
Anthony Romano
committed
*: remove os.Kill from signal.Notify
Clears SA1016 in staticcheck
1 parent d31701b commit 7e05b33

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

etcdctl/ctlv3/command/elect_command.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"errors"
1919
"os"
2020
"os/signal"
21+
"syscall"
2122

2223
"github.com/coreos/etcd/clientv3"
2324
"github.com/coreos/etcd/clientv3/concurrency"
@@ -73,7 +74,7 @@ func observe(c *clientv3.Client, election string) error {
7374

7475
donec := make(chan struct{})
7576
sigc := make(chan os.Signal, 1)
76-
signal.Notify(sigc, os.Interrupt, os.Kill)
77+
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
7778
go func() {
7879
<-sigc
7980
cancel()
@@ -107,7 +108,7 @@ func campaign(c *clientv3.Client, election string, prop string) error {
107108

108109
donec := make(chan struct{})
109110
sigc := make(chan os.Signal, 1)
110-
signal.Notify(sigc, os.Interrupt, os.Kill)
111+
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
111112
go func() {
112113
<-sigc
113114
cancel()

etcdctl/ctlv3/command/lock_command.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"errors"
1919
"os"
2020
"os/signal"
21+
"syscall"
2122

2223
"github.com/coreos/etcd/clientv3"
2324
"github.com/coreos/etcd/clientv3/concurrency"
@@ -57,7 +58,7 @@ func lockUntilSignal(c *clientv3.Client, lockname string) error {
5758
// unlock in case of ordinary shutdown
5859
donec := make(chan struct{})
5960
sigc := make(chan os.Signal, 1)
60-
signal.Notify(sigc, os.Interrupt, os.Kill)
61+
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
6162
go func() {
6263
<-sigc
6364
cancel()

main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestMain(t *testing.T) {
2929
}
3030

3131
notifier := make(chan os.Signal, 1)
32-
signal.Notify(notifier, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL)
32+
signal.Notify(notifier, syscall.SIGINT, syscall.SIGTERM)
3333
go main()
3434
<-notifier
3535
}

test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function fmt_pass {
281281
if [ -n "${staticcheckResult}" ]; then
282282
# TODO: resolve these after go1.8 migration
283283
# See https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck
284-
STATIC_CHECK_MASK="SA(1016|1019|2002)"
284+
STATIC_CHECK_MASK="SA(1019|2002)"
285285
if echo "${staticcheckResult}" | egrep -v "$STATIC_CHECK_MASK"; then
286286
echo -e "staticcheck checking ${path} failed:\n${staticcheckResult}"
287287
exit 255

0 commit comments

Comments
 (0)