Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/setup-go-5
Browse files Browse the repository at this point in the history
  • Loading branch information
xztaityozx authored Dec 16, 2024
2 parents 0316f4b + c97c3b1 commit 5c93a24
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
types: [opened, synchronize, reopened]
paths:
- '**.go'
- '.github/workflows/go.yaml'
- '.github/workflows/go.yml'
- 'test/e2e/**'

jobs:
Expand All @@ -21,7 +21,7 @@ jobs:
with:
go-version: ^1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: latest

Expand All @@ -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

0 comments on commit 5c93a24

Please sign in to comment.