Skip to content
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
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ DEB_HASH=$(shell git rev-parse HEAD)

export GO111MODULE=on

.PHONY: vendor vetcheck fmtcheck clean build gotest update-go-deps
.PHONY: vendor vetcheck modernize-check fmtcheck clean build gotest update-go-deps

all: vendor vetcheck fmtcheck gotest mod-clean build-node-native
all: vendor vetcheck modernize-check fmtcheck gotest mod-clean build-node-native

ci: vendor vetcheck fmtcheck release-node build-importer-native gotest-race-coverage mod-clean

Expand Down Expand Up @@ -71,6 +71,12 @@ vetcheck:
golangci-lint run -c .golangci.yml
golangci-lint run -c .golangci-strict.yml --new-from-rev=origin/master

modernize-check:
@bash -lc 'set -o pipefail; \
output=$$(go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest ./... 2>&1 | \
grep -vE "\.(pb|gen)\.go|mock|_string.go|^exit status|^go: downloading"); \
[ -n "$$output" ] && { echo "$$output"; exit 1; } || exit 0;'

strict-vet-check:
golangci-lint run -c .golangci-strict.yml

Expand Down
7 changes: 4 additions & 3 deletions pkg/ride/functions_strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,11 @@ func contains(_ environment, args ...rideType) (rideType, error) {
}

func runesIndex(s, sub string) int {
if i := strings.Index(s, sub); i >= 0 {
return utf8.RuneCountInString(s[:i])
before, _, ok := strings.Cut(s, sub)
if !ok {
return -1
}
return -1
return utf8.RuneCountInString(before)
}

func runesDrop(s string, n int) string {
Expand Down
Loading