Skip to content

Commit b63edc3

Browse files
committed
fix lint warnings
1 parent aac64bc commit b63edc3

7 files changed

Lines changed: 21 additions & 7 deletions

File tree

.golangci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "2"
2+
linters:
3+
exclusions:
4+
paths:
5+
- third_party
6+
settings:
7+
errcheck:
8+
exclude-functions:
9+
- fmt.Fprint
10+
- fmt.Fprintf
11+
- fmt.Fprintln
12+
- (*os.File).Close
13+
- os.RemoveAll
14+
- os.Unsetenv

action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (a Action) split(pipelines bool) Action {
320320
case shlex.QUOTING_STATE:
321321
invoked.action.rawValues[index].Value = fmt.Sprintf(`'%v'`, strings.ReplaceAll(value.Value, `'`, `'"'"'`))
322322
default:
323-
invoked.action.rawValues[index].Value = strings.Replace(value.Value, ` `, `\ `, -1)
323+
invoked.action.rawValues[index].Value = strings.ReplaceAll(value.Value, ` `, `\ `)
324324
}
325325
}
326326
if !invoked.action.meta.Nospace.Matches(value.Value) {

docs/book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ enable = true
1919

2020
[output.linkcheck]
2121
follow-web-links = true
22-
exclude = [ 'gnu\.org', '\./.+/out/.+\.gif', 'go\.dev', 'microsoft\.com']
22+
exclude = [ 'gnu\.org', '\./.+/out/.+\.gif', 'go\.dev', 'microsoft\.com', 'iridakos\.com']

internal/common/message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (m Messages) Integrate(values RawValues, prefix string) RawValues {
126126
}
127127

128128
func (m Messages) MarshalJSON() ([]byte, error) {
129-
var result []string = make([]string, 0, len(m.messages))
129+
var result = make([]string, 0, len(m.messages))
130130
for key := range m.messages {
131131
result = append(result, key)
132132
}

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func load(name string, c configMap) error {
9595
func GetStyleConfigs() []string { return config.Styles.Keys() }
9696
func GetStyleFields(name string) ([]Field, error) { return config.Styles.Fields(name) }
9797
func SetStyle(key, value string) error {
98-
return set("styles", key, strings.Replace(value, ",", " ", -1))
98+
return set("styles", key, strings.ReplaceAll(value, ",", " "))
9999
}
100100

101101
func set(name, key, value string) error {

internal/shell/tcsh/action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func ActionRawValues(currentWord string, meta common.Meta, values common.RawValu
7474
for _, r := range values {
7575
// TODO optimize
7676
if wordbreaks, ok := os.LookupEnv("COMP_WORDBREAKS"); ok {
77-
wordbreaks = strings.Replace(wordbreaks, " ", "", -1)
77+
wordbreaks = strings.ReplaceAll(wordbreaks, " ", "")
7878
if index := strings.LastIndexAny(currentWord, wordbreaks); index != -1 {
7979
r.Value = strings.TrimPrefix(r.Value, currentWord[:index+1])
8080
lastSegment = currentWord[index+1:]
@@ -101,7 +101,7 @@ func ActionRawValues(currentWord string, meta common.Meta, values common.RawValu
101101
} else {
102102
if val.Description != "" {
103103
// TODO seems actual value needs to be used or it won't be shown if the prefix doesn't match
104-
vals[index] = fmt.Sprintf("%v_(%v)", quoter.Replace(sanitizer.Replace(val.Value)), quoter.Replace(strings.Replace(sanitizer.Replace(val.TrimmedDescription()), " ", "_", -1)))
104+
vals[index] = fmt.Sprintf("%v_(%v)", quoter.Replace(sanitizer.Replace(val.Value)), quoter.Replace(strings.ReplaceAll(sanitizer.Replace(val.TrimmedDescription()), " ", "_")))
105105
} else {
106106
vals[index] = quoter.Replace(sanitizer.Replace(val.Value))
107107
}

internal/shell/xonsh/snippet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
// Snippet creates the xonsh completion script.
1313
func Snippet(cmd *cobra.Command) string {
14-
functionName := strings.Replace(cmd.Name(), "-", "__", -1)
14+
functionName := strings.ReplaceAll(cmd.Name(), "-", "__")
1515
return fmt.Sprintf(`from xonsh.completers.completer import add_one_completer
1616
from xonsh.completers.tools import contextual_command_completer
1717

0 commit comments

Comments
 (0)