8000 fix(enterprise/cli): add missing defer close of closer funcs by mafredri · Pull Request #15986 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix(enterprise/cli): add missing defer close of closer funcs #15986

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

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(enterprise/cli): add missing defer close of closer funcs
  • Loading branch information
mafredri committed Dec 31, 2024
commit b22bb0f6880b1bb6b9fbccebfc1dc460ef8caaee
9 changes: 5 additions & 4 deletions enterprise/cli/proxyserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ import (
"github.com/coder/serpent"
)

type closers []func()
type closerFuncs []func()

func (c closers) Close() {
func (c closerFuncs) Close() {
for _, closeF := range c {
closeF()
}
}

func (c *closers) Add(f func()) {
func (c *closerFuncs) Add(f func()) {
*c = append(*c, f)
}

Expand Down Expand Up @@ -113,7 +113,8 @@ func (r *RootCmd) proxyServer() *serpent.Command {
serpent.RequireNArgs(0),
),
Handler: func(inv *serpent.Invocation) error {
var closers closers
var closers closerFuncs
defer closers.Close()
// Main command context for managing cancellation of running
// services.
ctx, topCancel := context.WithCancel(inv.Context())
Expand Down
Loading
0