Skip to content

Commit 0825ab8

Browse files
committed
fix more hints
1 parent bb764b9 commit 0825ab8

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

third_party/github.com/drone/envsubst/template.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package envsubst
33
import (
44
"bytes"
55
"io"
6-
"io/ioutil"
6+
"os"
77

88
"github.com/carapace-sh/carapace/third_party/github.com/drone/envsubst/parse"
99
)
@@ -38,7 +38,7 @@ func Parse(s string) (t *Template, err error) {
3838
// ParseFile creates a new shell format template and parses the template
3939
// definition from the named file.
4040
func ParseFile(path string) (*Template, error) {
41-
b, err := ioutil.ReadFile(path)
41+
b, err := os.ReadFile(path)
4242
if err != nil {
4343
return nil, err
4444
}

third_party/github.com/hexops/gotextdiff/diff.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,9 @@ func addEdit(before string, edits []TextEdit, edit TextEdit) []TextEdit {
132132
if start.Offset() >= len(before) && start.Line() > 1 && before[len(before)-1] != '\n' {
133133
// after end of file that does not end in eol, so join to last line of file
134134
// to do this we need to know where the start of the last line was
135-
eol := strings.LastIndex(before, "\n")
136-
if eol < 0 {
135+
eol := max(strings.LastIndex(before, "\n"),
137136
// file is one non terminated line
138-
eol = 0
139-
}
137+
0)
140138
delta := len(before) - eol
141139
start = span.NewPoint(start.Line()-1, 1, start.Offset()-delta)
142140
edit.Span = span.New(edit.Span.URI(), start, end)

third_party/github.com/mitchellh/go-ps/process_freebsd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func processes() ([]Process, error) {
187187
count := int(length / uint64(procinfo_len))
188188

189189
// parse buf to procs
190-
for i := 0; i < count; i++ {
190+
for i := range count {
191191
b := buf[i*procinfo_len : i*procinfo_len+procinfo_len]
192192
k, err := parse_kinfo_proc(b)
193193
if err != nil {

third_party/github.com/mitchellh/go-ps/process_solaris.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (p *UnixProcess) Refresh() error {
8787
}
8888

8989
func toString(array []byte, len int) string {
90-
for i := 0; i < len; i++ {
90+
for i := range len {
9191
if array[i] == 0 {
9292
return string(array[:i])
9393
}

0 commit comments

Comments
 (0)