Skip to content

Commit 507614c

Browse files
committed
Fix staticheck warnings, update dependencies
1 parent 5f56f49 commit 507614c

363 files changed

Lines changed: 27679 additions & 98935 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ APP_NAME:=nova-password
33
PWD:=$(shell pwd)
44
UID:=$(shell id -u)
55
VERSION:=$(shell git describe --tags --always --dirty="-dev")
6-
LDFLAGS:=-X main.Version=$(VERSION)
6+
LDFLAGS:=-X main.Version=$(VERSION) -w -s
77

88
export CGO_ENABLED:=0
99

@@ -13,6 +13,7 @@ build: fmt vet
1313
GOOS=windows go build -mod=vendor -ldflags="$(LDFLAGS)" -o bin/$(APP_NAME).exe $(PKG)
1414

1515
docker:
16+
docker pull golang:latest
1617
docker run -ti --rm -e GOCACHE=/tmp -v $(PWD):/$(APP_NAME) -u $(UID):$(UID) --workdir /$(APP_NAME) golang:latest make
1718

1819
fmt:

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module github.com/sapcc/nova-password
22

3-
go 1.14
3+
go 1.15
44

55
require (
66
github.com/google/uuid v1.1.2
7-
github.com/gophercloud/gophercloud v0.13.0
8-
github.com/gophercloud/utils v0.0.0-20200918191848-da0e919a012a
7+
github.com/gophercloud/gophercloud v0.15.1-0.20210205220151-18b16b34db5c
8+
github.com/gophercloud/utils v0.0.0-20210209042946-13abf2251886
99
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
10-
github.com/kayrus/putty v1.0.1
10+
github.com/kayrus/putty v1.0.2
1111
github.com/spf13/cobra v1.0.0
1212
github.com/spf13/viper v1.7.1
13-
golang.org/x/crypto v0.0.0-20201002094018-c90954cbb977
13+
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
1414
)

go.sum

Lines changed: 19 additions & 49 deletions
Large diffs are not rendered by default.

main.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var RootCmd = &cobra.Command{
5353
// Convert Unix path type to Windows path type, when necessary
5454
keyPath := filepath.FromSlash(viper.GetString("private-key-path"))
5555

56-
if quiet == false {
56+
if !quiet {
5757
log.Printf("private-key-path: %s\n", keyPath)
5858
}
5959

@@ -126,8 +126,8 @@ var RootCmd = &cobra.Command{
126126
for _, server := range args {
127127
err = processServer(client, server, v, wait, quiet)
128128
if err != nil {
129-
log.Printf("Error getting the password for the %q server: %s", server, err)
130-
errors = append(errors, fmt.Errorf("Error getting the password for the %q server: %s", server, err))
129+
log.Printf("error getting the password for the %q server: %s", server, err)
130+
errors = append(errors, fmt.Errorf("error getting the password for the %q server: %s", server, err))
131131
}
132132
}
133133
default:
@@ -234,14 +234,14 @@ func processServer(client *gophercloud.ServiceClient, server string, privateKey
234234
if err != nil {
235235
return err
236236
}
237-
if quiet == false {
237+
if !quiet {
238238
log.Printf("Resolved %q server name to the %q uuid", tmp, server)
239239
}
240240
}
241241

242242
var res servers.GetPasswordResult
243243
if wait > 0 {
244-
if quiet == false {
244+
if !quiet {
245245
log.Printf("Waiting for %d seconds to get the password", wait)
246246
}
247247
// Wait for the encrypted server password
@@ -264,7 +264,7 @@ func processServer(client *gophercloud.ServiceClient, server string, privateKey
264264
return err
265265
}
266266

267-
if quiet == false {
267+
if !quiet {
268268
fmt.Printf("%q instance password: %s\n", tmp, pwd)
269269
} else {
270270
fmt.Printf("%s\n", pwd)
@@ -312,7 +312,7 @@ func readKey(path string) ([]byte, error) {
312312

313313
size := stat.Size()
314314
if size > MaxKeySize {
315-
return nil, fmt.Errorf("Invalid key size: %d bytes", size)
315+
return nil, fmt.Errorf("invalid key size: %d bytes", size)
316316
}
317317

318318
if size == 0 {
@@ -335,8 +335,8 @@ func getKeyPass(quiet bool) ([]byte, error) {
335335
pass := env.Getenv("NOVA_PASSWORD_KEY_PASSWORD")
336336

337337
if pass == "" {
338-
if quiet == true {
339-
return nil, fmt.Errorf(`Private key is encrypted with the password, please set the "NOVA_PASSWORD_KEY_PASSWORD" environment variable`)
338+
if quiet {
339+
return nil, fmt.Errorf(`private key is encrypted with the password, please set the "NOVA_PASSWORD_KEY_PASSWORD" environment variable`)
340340
}
341341

342342
log.Print("Private key is encrypted with the password")

vendor/github.com/gophercloud/gophercloud/.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

vendor/github.com/gophercloud/gophercloud/CHANGELOG.md

Lines changed: 94 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gophercloud/gophercloud/README.md

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gophercloud/gophercloud/doc.go

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gophercloud/gophercloud/go.mod

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gophercloud/gophercloud/go.sum

Lines changed: 11 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)