Skip to content

Commit

Permalink
Update cloud-sdk-go to 1.14.0 (#622)
Browse files Browse the repository at this point in the history
Updates the SDK, and also fixes some problems with the build:

- golangci-lint 1.50.1 doesn't work when go 1.20 is installed -> updated to latest version
- updated go everywhere to 1.20
- removed golint, as it is deprecated and unmaintainted. According to the golint site, `go vet` is a replacement
- with 1.20, `rand.Seed` is deprecated and the random number generator is seeded randomly by default
  • Loading branch information
gigerdo authored Oct 19, 2023
1 parent fd37558 commit fa8db37
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: "1.20"
id: go

- name: Bump main version
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: "1.20"
id: go

- name: Bump main version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: "1.20"
id: go

- name: Check out code into the Go module directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on_master_generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: "1.20"
id: go

- run: make format
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: "1.20"
id: go

- name: Cache Go Modules
Expand Down
16 changes: 8 additions & 8 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ecctl
Copyright 2019-2022 Elasticsearch B.V.
Copyright 2019-2023 Elasticsearch B.V.

This product includes software developed at Elasticsearch B.V. and
third-party software developed by the licenses listed below.
Expand All @@ -21,7 +21,6 @@ github.com/go-openapi/validate Apache-2.0
github.com/inconshreveable/mousetrap Apache-2.0
github.com/oklog/ulid Apache-2.0
github.com/opentracing/opentracing-go Apache-2.0
github.com/pelletier/go-toml Apache-2.0
github.com/spf13/afero Apache-2.0
github.com/spf13/cobra Apache-2.0
go.mongodb.org/mongo-driver Apache-2.0
Expand All @@ -31,31 +30,32 @@ gopkg.in/yaml.v3 Apache-2.0
github.com/magiconair/properties BSD-2-Clause
github.com/pkg/errors BSD-2-Clause
github.com/russross/blackfriday/v2 BSD-2-Clause
github.com/puerkitobio/purell BSD-3-Clause
github.com/puerkitobio/urlesc BSD-3-Clause
github.com/fsnotify/fsnotify BSD-3-Clause
github.com/pmezard/go-difflib BSD-3-Clause
github.com/sagikazarmark/slog-shim BSD-3-Clause
github.com/spf13/pflag BSD-3-Clause
golang.org/x/net BSD-3-Clause
golang.org/x/exp BSD-3-Clause
golang.org/x/sys BSD-3-Clause
golang.org/x/term BSD-3-Clause
golang.org/x/text BSD-3-Clause
github.com/asaskevich/govalidator MIT
github.com/blang/semver/v4 MIT
github.com/cpuguy83/go-md2man/v2 MIT
github.com/go-stack/stack MIT
github.com/josharian/intern MIT
github.com/mailru/easyjson MIT
github.com/mitchellh/mapstructure MIT
github.com/pelletier/go-toml/v2 MIT
github.com/sagikazarmark/locafero MIT
github.com/sourcegraph/conc MIT
github.com/spf13/cast MIT
github.com/spf13/jwalterweatherman MIT
github.com/spf13/viper MIT
github.com/stretchr/testify MIT
github.com/subosito/gotenv MIT
go.uber.org/atomic MIT
go.uber.org/multierr MIT
github.com/hashicorp/errwrap MPL-2.0
github.com/hashicorp/go-multierror MPL-2.0
github.com/hashicorp/hcl MPL-2.0
github.com/hashicorp/go-multierror MPL-2.0-no-copyleft-exception
github.com/ghodss/yaml no license file was found

=========================================================================
13 changes: 2 additions & 11 deletions build/Makefile.deps
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,20 @@ OS:=$(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH:=$(shell $(PWD)/scripts/uname_arch.sh)
VERSION_DIR:=$(GOBIN)/versions

VERSION_GOLINT:=v0.0.0-20191125180803-fdd1cda4f05f
VERSION_GOLICENSER:=v0.3.0
VERSION_GOLANGCILINT:=v1.50.1
VERSION_GOLANGCILINT:=v1.54.2
VERSION_GOBINDATA:=v0.0.0-20190711162640-ee3c2418e368
VERSION_GORELEASER:=v1.2.5
VERSION_VERSIONBUMP:=v1.1.0

deps: $(GOBIN)/golint $(GOBIN)/go-licenser $(GOBIN)/golangci-lint $(GOBIN)/go-bindata
deps: $(GOBIN)/go-licenser $(GOBIN)/golangci-lint $(GOBIN)/go-bindata

$(GOBIN):
@ mkdir -p $(GOBIN)

$(VERSION_DIR): | $(GOBIN)
@ mkdir -p $(GOBIN)/versions

$(VERSION_DIR)/.version-golint-$(VERSION_GOLINT): | $(VERSION_DIR)
@ rm -f $(VERSION_DIR)/.version-golint-*
@ echo $(VERSION_GOLINT) > $(VERSION_DIR)/.version-golint-$(VERSION_GOLINT)

$(GOBIN)/golint: $(VERSION_DIR)/.version-golint-$(VERSION_GOLINT) | $(GOBIN)
@ echo "-> Installing golint..."
@ go install golang.org/x/lint/golint@$(VERSION_GOLINT)

$(VERSION_DIR)/.version-go-licenser-$(VERSION_GOLICENSER): | $(VERSION_DIR)
@ rm -f $(VERSION_DIR)/.version-go-licenser-*
@ echo $(VERSION_GOLICENSER) > $(VERSION_DIR)/.version-go-licenser-$(VERSION_GOLICENSER)
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ notice:
.PHONY: lint
lint: deps
@ echo "-> Running linters..."
@ $(GOBIN)/golint -set_exit_status cmd/... pkg/ecctl/... pkg/util/...
@ go vet
@ $(GOBIN)/golangci-lint run --deadline=5m
@ $(GOBIN)/go-licenser -d .
@ echo "-> Done."
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/elastic/ecctl

go 1.19
go 1.20

require (
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/elastic/cloud-sdk-go v1.13.0
github.com/elastic/cloud-sdk-go v1.14.0
github.com/go-openapi/runtime v0.23.0
github.com/go-openapi/strfmt v0.21.2
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/elastic/cloud-sdk-go v1.13.0 h1:mngeBF+dobwinwkQUpSDjBqg1YN2q7TVgWEYMzREChk=
github.com/elastic/cloud-sdk-go v1.13.0/go.mod h1:dh2fVOBz598EslgiYW2az816DziJF5HQkzGOjf60Qj0=
github.com/elastic/cloud-sdk-go v1.14.0 h1:BrteR1slcLxMG080381ov5g5dhwcGug7unp/+8+8ZQg=
github.com/elastic/cloud-sdk-go v1.14.0/go.mod h1:dh2fVOBz598EslgiYW2az816DziJF5HQkzGOjf60Qj0=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
Expand Down
2 changes: 0 additions & 2 deletions pkg/util/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ package util

import (
"math/rand"
"time"
)

const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

// RandomString generates a random strings with a defined length.
func RandomString(n int) string {
rand.Seed(time.Now().UnixNano())
b := make([]byte, n)
for i := range b {
b[i] = letterBytes[rand.Intn(len(letterBytes))]
Expand Down

0 comments on commit fa8db37

Please sign in to comment.