Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump actions/cache from 3 to 4 #46

Merged
merged 9 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: before cache
run: |
mkdir -p ~/go/pkg/mod
- uses: actions/cache@v3
- uses: actions/cache@v4
id: cache-go
with:
key: ${{ matrix.os }}-go-${{ hashFiles('**/go.sum') }}
Expand Down
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/xztaityozx/sel

go 1.21
go 1.23

require (
github.com/spf13/cobra v1.8.0
Expand Down
13 changes: 7 additions & 6 deletions internal/iterator/iterator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package iterator

import (
"errors"
"fmt"
"regexp"
"strings"
Expand Down Expand Up @@ -96,7 +97,7 @@ func (i *Iterator) Reset(s string) {
// ElementAt は指定したインデックスの値を返す。1-indexed
func (i *Iterator) ElementAt(idx int) (string, error) {
if idx == 0 {
return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
}

if idx < 0 {
Expand All @@ -116,7 +117,7 @@ func (i *Iterator) ElementAt(idx int) (string, error) {
return s, nil
}

return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
} else {
if i.head >= idx {
return i.buf[idx], nil
Expand All @@ -136,7 +137,7 @@ func (i *Iterator) ElementAt(idx int) (string, error) {
}
}

return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
}
}

Expand Down Expand Up @@ -262,7 +263,7 @@ type RegexpIterator struct {

func (r *RegexpIterator) ElementAt(idx int) (string, error) {
if idx == 0 {
return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
}

if idx > 0 {
Expand All @@ -284,7 +285,7 @@ func (r *RegexpIterator) ElementAt(idx int) (string, error) {
}
}

return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
} else {
// 負のインデックス指定されたとき
// rightmostなIndexの検索ができないので残りの文字列をすべて分割してしまう
Expand Down Expand Up @@ -329,7 +330,7 @@ func (r *RegexpIterator) ElementAt(idx int) (string, error) {
return s, nil
}

return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
}
}

Expand Down
6 changes: 3 additions & 3 deletions internal/iterator/presplit.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package iterator

import (
"fmt"
"errors"
"regexp"
"strings"
)
Expand All @@ -18,12 +18,12 @@ type PreSplitIterator struct {

func (p *PreSplitIterator) ElementAt(idx int) (string, error) {
if p.l < idx {
return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
}

if idx < 0 {
if -p.l > idx {
return "", fmt.Errorf(IndexOutOfRange)
return "", errors.New(IndexOutOfRange)
}
return p.a[p.l+idx], nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/option/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type InputFiles struct {

// Enumerate /path/to/input/files
func (ifs InputFiles) Enumerate() ([]string, error) {
if ifs.Files == nil || len(ifs.Files) == 0 {
if len(ifs.Files) == 0 {
return nil, fmt.Errorf("there are no files")
}

Expand Down
Loading