Skip to content

Commit 398bf99

Browse files
authored
cmd: Remove newer version check on ecctl version (#103)
Removes the check for a newer version against the current ecctl version since it requires a GitHub Token. It is not the most useful of features and not well documented. It would be handy to have the ability to check for newer versions without any request token or authenticaiton. For the time being I am removing the check. Signed-off-by: Marc Lopez <marc5.12@outlook.com>
1 parent 4fcde59 commit 398bf99

File tree

5 files changed

+2
-85
lines changed

5 files changed

+2
-85
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SHELL := /bin/bash
2-
export VERSION ?= 1.0.0-beta1
2+
export VERSION ?= v1.0.0-beta1
33
export GO111MODULE ?= on
44
export GOBIN = $(shell pwd)/bin
55
BINARY := ecctl

NOTICE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ third-party software developed by the licenses listed below.
88

99
github.com/davecgh/go-spew 0BSD
1010
github.com/elastic/cloud-sdk-go Apache-2.0
11-
github.com/elastic/uptd Apache-2.0
1211
github.com/go-openapi/runtime Apache-2.0
1312
github.com/go-openapi/strfmt Apache-2.0
1413
github.com/marclop/elasticsearch-cli Apache-2.0
1514
github.com/spf13/cobra Apache-2.0
1615
github.com/pkg/errors BSD-2-Clause
1716
github.com/pmezard/go-difflib BSD-3-Clause
1817
golang.org/x/crypto BSD-3-Clause
19-
golang.org/x/oauth2 BSD-3-Clause
2018
github.com/asaskevich/govalidator MIT
2119
github.com/blang/semver MIT
2220
github.com/chzyer/test MIT

cmd/version.go

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -19,83 +19,19 @@ package cmd
1919

2020
import (
2121
"fmt"
22-
"io"
23-
"os"
24-
"runtime"
2522

26-
"github.com/elastic/uptd"
27-
"github.com/pkg/errors"
2823
"github.com/spf13/cobra"
29-
30-
"github.com/elastic/ecctl/pkg/ecctl"
31-
)
32-
33-
const (
34-
updateFmt = `
35-
Your version of %s is out of date! The latest version is %s.
36-
You can use the binaries from %s.`
37-
)
38-
39-
var (
40-
errWrapError = errors.New("\ncan't check newer version")
41-
primaryGithubToken = "GITHUB_TOKEN"
42-
fallbackGithubToken = "HOMEBREW_GITHUB_API_TOKEN"
4324
)
4425

4526
var versionCmd = &cobra.Command{
4627
Use: "version",
4728
Short: "Shows ecctl version",
4829
PreRunE: cobra.MaximumNArgs(0),
49-
RunE: func(cmd *cobra.Command, args []string) error {
30+
Run: func(cmd *cobra.Command, args []string) {
5031
fmt.Fprint(cmd.OutOrStdout(), versionInfo)
51-
52-
return checkUpdate(versionInfo, cmd.OutOrStderr())
5332
},
5433
}
5534

56-
func githubToken() string {
57-
var envVars = []string{primaryGithubToken}
58-
if runtime.GOOS == "darwin" {
59-
envVars = append(envVars, fallbackGithubToken)
60-
}
61-
for _, key := range envVars {
62-
if token := os.Getenv(key); token != "" {
63-
return token
64-
}
65-
}
66-
return ""
67-
}
68-
69-
func checkUpdate(version ecctl.VersionInfo, device io.Writer) error {
70-
githubUpdateProvider, err := uptd.NewGithubProvider(
71-
version.Organization, version.Repository, githubToken(),
72-
)
73-
if err != nil {
74-
fmt.Fprintln(device, errors.Wrap(err, errWrapError.Error()))
75-
return nil
76-
}
77-
78-
uptodate, err := uptd.New(githubUpdateProvider, version.Version)
79-
if err != nil {
80-
fmt.Fprintln(device, errors.Wrap(err, errWrapError.Error()))
81-
return nil
82-
}
83-
84-
res, err := uptodate.Check()
85-
if err != nil {
86-
fmt.Fprintln(device, errors.Wrap(err, errWrapError.Error()))
87-
return nil
88-
}
89-
90-
if res.NeedsUpdate {
91-
var message = fmt.Sprintf(updateFmt, RootCmd.Name(),
92-
res.Latest.Version.String(), res.Latest.URL,
93-
)
94-
fmt.Fprintln(device, message)
95-
}
96-
return nil
97-
}
98-
9935
func init() {
10036
RootCmd.AddCommand(versionCmd)
10137
}

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect
1010
github.com/davecgh/go-spew v1.1.1
1111
github.com/elastic/cloud-sdk-go v1.0.0-bc9
12-
github.com/elastic/uptd v1.0.0
1312
github.com/ghodss/yaml v1.0.0
1413
github.com/go-openapi/runtime v0.19.9
1514
github.com/go-openapi/strfmt v0.19.4
@@ -20,7 +19,6 @@ require (
2019
github.com/spf13/cobra v0.0.5
2120
github.com/spf13/viper v1.6.1
2221
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472
23-
golang.org/x/oauth2 v0.0.0-20190211225200-5f6b76b7c9dd // indirect
2422
)
2523

2624
replace sourcegraph.com/sourcegraph/go-diff v0.5.1 => github.com/sourcegraph/go-diff v0.5.1

go.sum

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2-
cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg=
3-
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
42
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
53
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
64
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
@@ -53,8 +51,6 @@ github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
5351
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
5452
github.com/elastic/cloud-sdk-go v1.0.0-bc9 h1:eSejM+/Lo6I/tQY9pyyBc9DFfjgMQibh7hQTkhbG5m0=
5553
github.com/elastic/cloud-sdk-go v1.0.0-bc9/go.mod h1:1F4QcQxagbU/2aU/X7IunC71i+AaNwK/dWzTXFP+ghs=
56-
github.com/elastic/uptd v1.0.0 h1:oUhbbTK6hjFYB5w5dwjo1HtbqrWyLiqj+6Sb05oawU8=
57-
github.com/elastic/uptd v1.0.0/go.mod h1:2Pm07gLal/a/gTPq3el2QgOjoxu97pB2I17AprXxa48=
5854
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
5955
github.com/fsnotify/fsnotify v0.0.0-20170329110642-4da3e2cfbabc/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
6056
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
@@ -158,10 +154,6 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
158154
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
159155
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
160156
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
161-
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
162-
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
163-
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
164-
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
165157
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
166158
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
167159
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -311,12 +303,10 @@ golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8U
311303
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
312304
golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
313305
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
314-
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
315306
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
316307
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
317308
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
318309
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
319-
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
320310
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
321311
golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53 h1:kcXqo9vE6fsZY5X5Rd7R1l7fTgnWaDCVmln65REefiE=
322312
golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -326,9 +316,6 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
326316
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=
327317
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
328318
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
329-
golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
330-
golang.org/x/oauth2 v0.0.0-20190211225200-5f6b76b7c9dd h1:rd5tHaP+H8HLsIM51kItbLHGLDYw9hZXkSJkjdYMWmk=
331-
golang.org/x/oauth2 v0.0.0-20190211225200-5f6b76b7c9dd/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
332319
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
333320
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
334321
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
@@ -365,8 +352,6 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3
365352
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
366353
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
367354
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
368-
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
369-
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
370355
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
371356
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
372357
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=

0 commit comments

Comments
 (0)