From f7dab2945b5db7221f942cb5c3ccc332ab92b0f9 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Thu, 30 Nov 2023 16:14:42 +0100 Subject: Remove dead code --- client/go/internal/admin/deploy/curl.go | 4 ---- client/go/internal/admin/jvm/mem_avail.go | 10 ---------- .../admin/vespa-wrapper/logfmt/formatflags_test.go | 6 ++---- client/go/internal/cli/cmd/prod_test.go | 17 ----------------- client/go/internal/cli/cmd/status_test.go | 16 ---------------- client/go/internal/mock/http.go | 4 ---- 6 files changed, 2 insertions(+), 55 deletions(-) (limited to 'client/go/internal') diff --git a/client/go/internal/admin/deploy/curl.go b/client/go/internal/admin/deploy/curl.go index accd16b06f5..6f77cf8c316 100644 --- a/client/go/internal/admin/deploy/curl.go +++ b/client/go/internal/admin/deploy/curl.go @@ -112,10 +112,6 @@ func curlPutArgs() []string { "--write-out", "\n%{http_code}") } -func curlGetArgs() []string { - return commonCurlArgs() -} - func curlPostArgs() []string { return append(commonCurlArgs(), "--write-out", "\n%{http_code}") diff --git a/client/go/internal/admin/jvm/mem_avail.go b/client/go/internal/admin/jvm/mem_avail.go index df5acf79043..661d42fed28 100644 --- a/client/go/internal/admin/jvm/mem_avail.go +++ b/client/go/internal/admin/jvm/mem_avail.go @@ -28,16 +28,6 @@ func parseFree(txt string) AmountOfMemory { return BytesOfMemory(0) } -func parentDir(dir string) string { - lastSlash := 0 - for idx, ch := range dir { - if ch == '/' { - lastSlash = idx - } - } - return dir[:lastSlash] -} - func readLineFrom(filename string) (string, error) { content, err := os.ReadFile(filename) s := string(content) diff --git a/client/go/internal/admin/vespa-wrapper/logfmt/formatflags_test.go b/client/go/internal/admin/vespa-wrapper/logfmt/formatflags_test.go index 42f82b4361f..39ba18b1255 100644 --- a/client/go/internal/admin/vespa-wrapper/logfmt/formatflags_test.go +++ b/client/go/internal/admin/vespa-wrapper/logfmt/formatflags_test.go @@ -3,14 +3,12 @@ package logfmt import ( "fmt" - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestOutputFormat(t *testing.T) { - type args struct { - val string - } tests := []struct { expected OutputFormat arg string diff --git a/client/go/internal/cli/cmd/prod_test.go b/client/go/internal/cli/cmd/prod_test.go index 4fed8de7d44..e2b0b3b88de 100644 --- a/client/go/internal/cli/cmd/prod_test.go +++ b/client/go/internal/cli/cmd/prod_test.go @@ -3,7 +3,6 @@ package cmd import ( "bytes" - "io" "os" "path/filepath" "strings" @@ -239,19 +238,3 @@ func TestProdDeployInvalidZip(t *testing.T) { assert.NotNil(t, cli.Run("prod", "deploy", zipFile)) assert.Equal(t, "Error: found invalid path inside zip: ../../../../../../../tmp/foo\n", stderr.String()) } - -func copyFile(t *testing.T, dstFilename, srcFilename string) { - dst, err := os.Create(dstFilename) - if err != nil { - t.Fatal(err) - } - defer dst.Close() - src, err := os.Open(srcFilename) - if err != nil { - t.Fatal(err) - } - defer src.Close() - if _, err := io.Copy(dst, src); err != nil { - t.Fatal(err) - } -} diff --git a/client/go/internal/cli/cmd/status_test.go b/client/go/internal/cli/cmd/status_test.go index 8bd8449d5a1..3c6277b9050 100644 --- a/client/go/internal/cli/cmd/status_test.go +++ b/client/go/internal/cli/cmd/status_test.go @@ -228,19 +228,3 @@ func assertStatus(expectedTarget string, args []string, t *testing.T) { assert.Nil(t, cli.Run(append(statusArgs, args...)...)) assert.Equal(t, expectedTarget+"\n", stdout.String()) } - -func assertDocumentStatus(target string, args []string, t *testing.T) { - t.Helper() - client := &mock.HTTPClient{} - if isLocalTarget(args) { - mockServiceStatus(client, "default") - } - cli, stdout, _ := newTestCLI(t) - cli.httpClient = client - assert.Nil(t, cli.Run("status", "document")) - assert.Equal(t, - "Container (document API) at "+target+" is ready\n", - stdout.String(), - "vespa status container") - assert.Equal(t, target+"/status.html", client.LastRequest.URL.String()) -} diff --git a/client/go/internal/mock/http.go b/client/go/internal/mock/http.go index 06e143ab80d..2fbaa85ecca 100644 --- a/client/go/internal/mock/http.go +++ b/client/go/internal/mock/http.go @@ -8,8 +8,6 @@ import ( "net/http" "strconv" "time" - - "github.com/vespa-engine/vespa/client/go/internal/httputil" ) type HTTPClient struct { @@ -94,5 +92,3 @@ func (c *HTTPClient) Do(request *http.Request, timeout time.Duration) (*http.Res }, nil } - -func (c *HTTPClient) Clone() httputil.Client { return c } -- cgit v1.2.3