aboutsummaryrefslogtreecommitdiffstats
path: root/client/go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2023-05-04 11:11:49 +0200
committerMartin Polden <mpolden@mpolden.no>2023-05-05 09:18:46 +0200
commite85541a8284abac3727f47a3d0cbf8674509f31b (patch)
tree20f8350c0afce47016c23d5ba46bc0b7b0e8d499 /client/go
parentfe621f7b37c9d0e279451ff6b77c72629537af91 (diff)
Remove github.com/kballard/go-shellquote
Diffstat (limited to 'client/go')
-rw-r--r--client/go/go.mod3
-rw-r--r--client/go/go.sum2
-rw-r--r--client/go/internal/cli/cmd/query_test.go2
-rw-r--r--client/go/internal/curl/curl.go4
-rw-r--r--client/go/internal/curl/curl_test.go15
5 files changed, 9 insertions, 17 deletions
diff --git a/client/go/go.mod b/client/go/go.mod
index ecea2332954..c70ee5b75c8 100644
--- a/client/go/go.mod
+++ b/client/go/go.mod
@@ -3,10 +3,10 @@ module github.com/vespa-engine/vespa/client/go
go 1.18
require (
+ github.com/alessio/shellescape v1.4.1
github.com/briandowns/spinner v1.23.0
github.com/fatih/color v1.15.0
github.com/goccy/go-json v0.10.2
- github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/klauspost/compress v1.16.5
github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.18
@@ -21,7 +21,6 @@ require (
)
require (
- github.com/alessio/shellescape v1.4.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
diff --git a/client/go/go.sum b/client/go/go.sum
index 4db05eec92f..9b79c215864 100644
--- a/client/go/go.sum
+++ b/client/go/go.sum
@@ -17,8 +17,6 @@ github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
-github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
-github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
diff --git a/client/go/internal/cli/cmd/query_test.go b/client/go/internal/cli/cmd/query_test.go
index 94b5a485b9d..1caf6d33e70 100644
--- a/client/go/internal/cli/cmd/query_test.go
+++ b/client/go/internal/cli/cmd/query_test.go
@@ -27,7 +27,7 @@ func TestQueryVerbose(t *testing.T) {
cli.httpClient = client
assert.Nil(t, cli.Run("query", "-v", "select from sources * where title contains 'foo'"))
- assert.Equal(t, "curl http://127.0.0.1:8080/search/\\?timeout=10s\\&yql=select+from+sources+%2A+where+title+contains+%27foo%27\n", stderr.String())
+ assert.Equal(t, "curl 'http://127.0.0.1:8080/search/?timeout=10s&yql=select+from+sources+%2A+where+title+contains+%27foo%27'\n", stderr.String())
assert.Equal(t, "{\n \"query\": \"result\"\n}\n", stdout.String())
}
diff --git a/client/go/internal/curl/curl.go b/client/go/internal/curl/curl.go
index b70e0f824a3..daa60e6ff14 100644
--- a/client/go/internal/curl/curl.go
+++ b/client/go/internal/curl/curl.go
@@ -7,7 +7,7 @@ import (
"os/exec"
"runtime"
- "github.com/kballard/go-shellquote"
+ "github.com/alessio/shellescape"
"github.com/vespa-engine/vespa/client/go/internal/util"
)
@@ -77,7 +77,7 @@ func (c *Command) Args() []string {
func (c *Command) String() string {
args := []string{c.Path}
args = append(args, c.Args()...)
- return shellquote.Join(args...)
+ return shellescape.QuoteCommand(args)
}
func (c *Command) Header(key, value string) {
diff --git a/client/go/internal/curl/curl_test.go b/client/go/internal/curl/curl_test.go
index 448e1e5199f..c8bcfb7f56b 100644
--- a/client/go/internal/curl/curl_test.go
+++ b/client/go/internal/curl/curl_test.go
@@ -5,13 +5,12 @@ import (
"testing"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
func TestPost(t *testing.T) {
c, err := Post("https://example.com")
- if err != nil {
- t.Fatal(err)
- }
+ require.Nil(t, err)
c.PrivateKey = "key.pem"
c.Certificate = "cert.pem"
c.WithBodyFile("file.json")
@@ -22,22 +21,18 @@ func TestPost(t *testing.T) {
func TestGet(t *testing.T) {
c, err := Get("https://example.com")
- if err != nil {
- t.Fatal(err)
- }
+ require.Nil(t, err)
c.PrivateKey = "key.pem"
c.Certificate = "cert.pem"
c.Param("yql", "select * from sources * where title contains 'foo';")
c.Param("hits", "5")
- assert.Equal(t, `curl --key key.pem --cert cert.pem https://example.com\?hits=5\&yql=select+%2A+from+sources+%2A+where+title+contains+%27foo%27%3B`, c.String())
+ assert.Equal(t, `curl --key key.pem --cert cert.pem 'https://example.com?hits=5&yql=select+%2A+from+sources+%2A+where+title+contains+%27foo%27%3B'`, c.String())
}
func TestRawArgs(t *testing.T) {
c, err := RawArgs("https://example.com/search", "-v", "-m", "10", "-H", "foo: bar")
- if err != nil {
- t.Fatal(err)
- }
+ assert.Nil(t, err)
c.PrivateKey = "key.pem"
c.Certificate = "cert.pem"