From 0d9473a32eb0ab6cb941b0537d6dd951319f0223 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 21 May 2021 08:56:56 -0700 Subject: [PATCH] remove --serve as global flag and add it as analyzeFlags (#178) --- .github/workflows/go.yml | 2 +- api/api.go | 15 ++++----------- cli/analyze.go | 4 ++++ cli/flags.go | 4 ---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3055646c..a04fc88c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go-version: [1.14.x, 1.15.x] + go-version: [1.15.x, 1.16.x] os: [ubuntu-latest] steps: - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} diff --git a/api/api.go b/api/api.go index fef6b360..23420fd8 100644 --- a/api/api.go +++ b/api/api.go @@ -249,19 +249,12 @@ func (s *Server) handleDownloadJSON(w http.ResponseWriter, req *http.Request) { // handleStop handles requests to `/v1/stop`, stops the service. func (s *Server) handleStop(w http.ResponseWriter, req *http.Request) { - if req.Method == http.MethodDelete { - w.WriteHeader(200) - w.Write([]byte(`bye...`)) - s.server.Close() - return - } - if req.Method == http.MethodGet { - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(200) - w.Write([]byte(`{"status": "ok"}`)) + if req.Method != http.MethodDelete { + w.WriteHeader(http.StatusBadRequest) return } - w.WriteHeader(http.StatusBadRequest) + w.Write([]byte(`bye...`)) + s.server.Close() } // NewBenchmarkMonitor creates a new Server. diff --git a/cli/analyze.go b/cli/analyze.go index 901e0e86..22fa70fd 100644 --- a/cli/analyze.go +++ b/cli/analyze.go @@ -80,6 +80,10 @@ var analyzeFlags = []cli.Flag{ Name: "analyze.v", Usage: "Display additional analysis data.", }, + cli.StringFlag{ + Name: serverFlagName, + Usage: "When running benchmarks open a webserver to fetch results remotely, eg: localhost:7762", + }, } var analyzeCmd = cli.Command{ diff --git a/cli/flags.go b/cli/flags.go index a0533212..c531aec2 100644 --- a/cli/flags.go +++ b/cli/flags.go @@ -53,10 +53,6 @@ var globalFlags = []cli.Flag{ Name: "autocompletion", Usage: "install auto-completion for your shell", }, - cli.StringFlag{ - Name: serverFlagName, - Usage: "When running benchmarks open a webserver to fetch results remotely, eg: localhost:7762", - }, } var profileFlags = []cli.Flag{