Skip to content

Commit

Permalink
fix: correct race condition (#1160)
Browse files Browse the repository at this point in the history
* fix: correct race condition

* fix: make URL parsing test work with Go 1.16

From the release notes in Go 1.17:

The net/url and net/http packages used to accept ";" (semicolon) as a
setting separator in URL queries, in addition to "&" (ampersand). Now,
settings with non-percent-encoded semicolons are rejected and net/http
servers will log a warning to Server.ErrorLog when encountering one in a
request URL.

See "URL query parsing" in https://go.dev/doc/go1.17.
  • Loading branch information
enocom committed Apr 5, 2022
1 parent 229f935 commit eb0c9f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestNewCommandWithErrors(t *testing.T) {
},
{
desc: "when the query string is bogus",
args: []string{"proj:region:inst?ke;y=b;ad"},
args: []string{"proj:region:inst?%=foo"},
},
{
desc: "when the address query param is empty",
Expand Down
6 changes: 3 additions & 3 deletions internal/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ func NewClient(ctx context.Context, d Dialer, cmd *cobra.Command, conf *Config)
var mnts []*socketMount
pc := newPortConfig(conf.Port)
for _, inst := range conf.Instances {
go func(i InstanceConnConfig) {
go func(name string) {
// Initiate refresh operation
d.EngineVersion(ctx, inst.Name)
}(inst)
d.EngineVersion(ctx, name)
}(inst.Name)
}
for _, inst := range conf.Instances {
m := &socketMount{inst: inst.Name}
Expand Down

0 comments on commit eb0c9f1

Please sign in to comment.