Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 1869c47

Browse files
committed
Fix lint
1 parent 3398d34 commit 1869c47

8 files changed

Lines changed: 16 additions & 16 deletions

File tree

internals/cli/cloneproc/spawn_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build linux darwin
1+
//go:build linux || darwin
22

33
package cloneproc
44

internals/cli/masker/stream.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package masker
33
import (
44
"bytes"
55
"io"
6-
"io/ioutil"
76
"sync"
87
"time"
98
)
@@ -80,7 +79,7 @@ func (s *stream) flush(n int) error {
8079
}
8180

8281
// Drop all bytes until the end of the mask.
83-
_, err = s.buf.writeUpToIndex(ioutil.Discard, i+int64(length))
82+
_, err = s.buf.writeUpToIndex(io.Discard, i+int64(length))
8483
if err != nil {
8584
return err
8685
}

internals/cli/progress/fakeprogress/progressprinter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !production
1+
//go:build !production
22

33
// Package fakeprogress provides an implementation of the progress.Printer interface
44
// to be used in tests.

internals/cli/ui/fakeui/testing.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !production
1+
//go:build !production
22

33
package fakeui
44

@@ -7,7 +7,6 @@ import (
77
"errors"
88
"fmt"
99
"io"
10-
"io/ioutil"
1110
"os"
1211
"testing"
1312

@@ -28,11 +27,11 @@ type FakeIO struct {
2827

2928
// NewIO creates a new FakeIO with empty buffers.
3029
func NewIO(t *testing.T) *FakeIO {
31-
tempDir, err := ioutil.TempDir("", "")
30+
tempDir, err := os.MkdirTemp("", "")
3231
assert.OK(t, err)
33-
stdIn, err := ioutil.TempFile(tempDir, "in")
32+
stdIn, err := os.CreateTemp(tempDir, "in")
3433
assert.OK(t, err)
35-
stdOut, err := ioutil.TempFile(tempDir, "out")
34+
stdOut, err := os.CreateTemp(tempDir, "out")
3635
assert.OK(t, err)
3736

3837
t.Cleanup(func() {
@@ -82,7 +81,7 @@ func (f *FakeIO) Stdout() *os.File {
8281
}
8382

8483
func (f *FakeIO) ReadStdout() ([]byte, error) {
85-
return ioutil.ReadFile(f.StdOut.Name())
84+
return os.ReadFile(f.StdOut.Name())
8685
}
8786

8887
// Prompts returns the mocked prompts and error.
@@ -99,7 +98,7 @@ func (f *FakeIO) IsOutputPiped() bool {
9998
}
10099

101100
func (f *FakeIO) ReadSecret() ([]byte, error) {
102-
return ioutil.ReadAll(f.PasswordReader)
101+
return io.ReadAll(f.PasswordReader)
103102
}
104103

105104
// FakeReader implements the Reader interface.

internals/onepassword/onepassword.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"os/exec"
109
"path/filepath"
@@ -157,7 +156,7 @@ func GetSignInAddress() (string, error) {
157156
if err != nil {
158157
return "", err
159158
}
160-
bytes, err := ioutil.ReadFile(filepath.Join(path, "config"))
159+
bytes, err := os.ReadFile(filepath.Join(path, "config"))
161160
if err != nil {
162161
return "", fmt.Errorf("could not read 1password config file at %s", path)
163162
}

internals/secrethub/fakes/timeformatter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !production
1+
//go:build !production
22

33
package fakes
44

internals/secrethub/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func writeNewCredential(credential *credentials.KeyCreator, passphrase string, c
353353
exportKey = exportKey.Passphrase(credentials.FromString(passphrase))
354354
}
355355

356-
encodedCredential, err := credential.Export()
356+
encodedCredential, err := exportKey.Export()
357357
if err != nil {
358358
return err
359359
}

internals/secrethub/list_formatters.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package secrethub
33
import (
44
"encoding/json"
55
"fmt"
6+
"golang.org/x/text/cases"
7+
"golang.org/x/text/language"
68
"io"
79
"strings"
810
)
@@ -38,7 +40,8 @@ func newJSONFormatter(writer io.Writer, fieldNames []string) *jsonFormatter {
3840
}
3941

4042
func toPascalCase(s string) string {
41-
return strings.ReplaceAll(strings.Title(s), " ", "")
43+
caser := cases.Title(language.English)
44+
return strings.ReplaceAll(caser.String(s), " ", "")
4245
}
4346

4447
type jsonFormatter struct {

0 commit comments

Comments
 (0)