jpillora / overseer

Monitorable, gracefully restarting, self-upgrading binaries in Go (golang)
MIT License
2.33k stars 209 forks source link

add notice for users don't printf in func init() #30

Closed guhan121 closed 3 years ago

guhan121 commented 5 years ago

if use a printf in func init(){}

This may cause the upgrade check to fail!

user will got sanity check failed

eg: add

func init() {
    fmt.Println("hahhahahhahahahaaha")
}

to github.com/jpillora/overseer/example/main.go

bogon:example qiantao$ ./example.sh 
BUILT APP (1)
RUNNING APP
hahhahahhahahahaaha
2019/03/22 17:22:13 [overseer master] run
2019/03/22 17:22:13 [overseer master] setupSignalling
2019/03/22 17:22:13 [overseer master] checking for updates...
2019/03/22 17:22:13 [overseer master] no updates
2019/03/22 17:22:13 [overseer master] starting /Users/qiantao/work/GoTestSrc/src/github.com/jpillora/overseer/example/my_app
hahhahahhahahahaaha
2019/03/22 17:22:13 [overseer slave#1] run
2019/03/22 17:22:13 [overseer slave#1] slave wait sp.Config.RestartSignal
2019/03/22 17:22:13 [overseer slave#1] start program
app#1 start
app#1 BuildDate=20190322_172211
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) listening...
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)
app#1 work
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)
app#1 work
BUILT APP (2)
2019/03/22 17:22:18 [overseer master] streaming update...
2019/03/22 17:22:18 [overseer master] sanity check failed
2019/03/22 17:22:18 [overseer master] checking for updates...
app#1 work
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)
2019/03/22 17:22:19 [overseer master] no updates
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)
app#1 work
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=5000000000)
BUILT APP (3)
app#1 work
2019/03/22 17:22:23 [overseer master] streaming update...
2019/03/22 17:22:23 [overseer master] sanity check failed
2019/03/22 17:22:23 [overseer master] checking for updates...
2019/03/22 17:22:24 [overseer master] no updates
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)
app#1 work
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=5000000000)
app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)
app#1 work
2019/03/22 17:22:27 [overseer master] proxy signal (terminated)
2019/03/22 17:22:27 [overseer master] prog exited with -1
jpillora commented 5 years ago

I think the sanity check function should instead look for a string contained in the output. Then it would ignore any extra strings found.

On Fri, 22 Mar 2019 at 20:27, guhan121 notifications@github.com wrote:

if use a printf in func init(){}

This may cause the upgrade check to fail!

user will got sanity check failed

eg: add

func init() {

fmt.Println("hahhahahhahahahaaha")

}

to github.com/jpillora/overseer/example/main.go

bogon:example qiantao$ ./example.sh

BUILT APP (1)

RUNNING APP

hahhahahhahahahaaha

2019/03/22 17:22:13 [overseer master] run

2019/03/22 17:22:13 [overseer master] setupSignalling

2019/03/22 17:22:13 [overseer master] checking for updates...

2019/03/22 17:22:13 [overseer master] no updates

2019/03/22 17:22:13 [overseer master] starting /Users/qiantao/work/GoTestSrc/src/github.com/jpillora/overseer/example/my_app

hahhahahhahahahaaha

2019/03/22 17:22:13 [overseer slave#1] run

2019/03/22 17:22:13 [overseer slave#1] slave wait sp.Config.RestartSignal

2019/03/22 17:22:13 [overseer slave#1] start program

app#1 start

app#1 BuildDate=20190322_172211

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) listening...

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)

app#1 work

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)

app#1 work

BUILT APP (2)

2019/03/22 17:22:18 [overseer master] streaming update...

2019/03/22 17:22:18 [overseer master] sanity check failed

2019/03/22 17:22:18 [overseer master] checking for updates...

app#1 work

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)

2019/03/22 17:22:19 [overseer master] no updates

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)

app#1 work

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=5000000000)

BUILT APP (3)

app#1 work

2019/03/22 17:22:23 [overseer master] streaming update...

2019/03/22 17:22:23 [overseer master] sanity check failed

2019/03/22 17:22:23 [overseer master] checking for updates...

2019/03/22 17:22:24 [overseer master] no updates

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)

app#1 work

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=5000000000)

app#1 (45fb899a1abd7bd65c698fbcbc6525bade97932f) says hello (d=0)

app#1 work

2019/03/22 17:22:27 [overseer master] proxy signal (terminated)

2019/03/22 17:22:27 [overseer master] prog exited with -1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jpillora/overseer/issues/30, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmr8woRDmNoPcSLpYZDlpFjff7QxzxKks5vZKIUgaJpZM4cDKJx .

wgjtyu commented 4 years ago

always got "sanity check failed" before remove fmt.Printf in the Init func. thanks, guhan121

yangyuan6 commented 3 years ago

always got "sanity check failed" before remove fmt.Printf in the Init func. thanks, guhan121

I fixed it. see mr