Skip to content

*: update go-svc#1319

Merged
jehiah merged 1 commit into
nsqio:masterfrom
jehiah:go_svc_update_1319
Feb 9, 2021
Merged

*: update go-svc#1319
jehiah merged 1 commit into
nsqio:masterfrom
jehiah:go_svc_update_1319

Conversation

@jehiah

@jehiah jehiah commented Feb 2, 2021

Copy link
Copy Markdown
Member

This extracts go-svc changes out of #1305 and to update the version go-svc we import.

@jehiah jehiah self-assigned this Feb 2, 2021
Comment thread go.mod Outdated
@jehiah
jehiah force-pushed the go_svc_update_1319 branch from 8fba4bc to cfc1f0e Compare February 2, 2021 14:53
@jehiah
jehiah requested review from mreiferson and ploxiln February 2, 2021 14:54
@jehiah

jehiah commented Feb 2, 2021

Copy link
Copy Markdown
Member Author

RFR @mreiferson @ploxiln

Comment thread apps/nsqadmin/main.go Outdated

"github.com/BurntSushi/toml"
"github.com/judwhite/go-svc/svc"
svc "github.com/judwhite/go-svc"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jehiah I don't think you need the import alias. I'm not using it in the example project

https://github.com/judwhite/go-svc/blob/a2deda217eb3db0e1264c3386d5e41f8c8b08207/example/main.go#L10

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm by convention i expect aliases when the package names doesn't match the directory name (i.e. svc and go-svc) but clearly there is more to goimports logic around this that I don't understand because it doesn't automatically add this alias (but leaves it if it's there).

I think either approach here is ok 🤷‍♂️

Comment thread apps/nsqd/main.go Outdated
Comment thread apps/nsqlookupd/main.go Outdated
Comment thread apps/nsqadmin/main.go
"github.com/BurntSushi/toml"
"github.com/judwhite/go-svc/svc"
svc "github.com/judwhite/go-svc"
"github.com/mreiferson/go-options"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jehiah You know, it was the early days. Every package started with go- 😆

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goodness knows I have a bunch of those myself 😢

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jehiah Sometimes I forget to mention what I'm trying to point out 🤦‍♂️ go-options (the line I clicked 'Comment' on) is used like options. It's no big deal, just pointing it out for consistency.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@judwhite That's a good point (and consistency is a compelling argument)

What i didn't know when i wrote this (it took me too long to track this down) is that goimports does special case the "go-" prefix when handling import paths; I didn't know that.

https://github.com/golang/tools/blob/b894a3290fff7ed8373c3156460600f8216a6c2d/internal/imports/fix.go#L1128-L1151

@jehiah
jehiah force-pushed the go_svc_update_1319 branch from 6a836a2 to ad73d05 Compare February 9, 2021 12:23
@jehiah
jehiah merged commit 5b9d7b4 into nsqio:master Feb 9, 2021
Comment thread apps/nsqd/main.go
p.nsqd.TermSignal()
}
}()
signal.Notify(signalChan, syscall.SIGTERM)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still feels odd to me that we have to separate out a signal to get the behavior we want. Feels like go-svc should be able to handle multiple signals, and "programs" can implement a callback act on a received signal and return something to go-svc indicating whether it should shut down?

@mreiferson mreiferson changed the title update go-svc *: update go-svc Mar 1, 2021
@mreiferson
mreiferson deleted the go_svc_update_1319 branch March 1, 2021 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants