Fix golint error
This commit is contained in:
parent
fe8fa91b20
commit
7348fd95e8
6
Makefile
6
Makefile
|
@ -1,5 +1,6 @@
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
|
PKGS := $(shell go list ./...)
|
||||||
SOURCES := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print)
|
SOURCES := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print)
|
||||||
|
|
||||||
.PHONY: setup
|
.PHONY: setup
|
||||||
|
@ -16,9 +17,8 @@ fmt: $(SOURCES) ## Formatting source codes.
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: ## Run golint and go vet.
|
lint: ## Run golint and go vet.
|
||||||
@golint .
|
@golint -set_exit_status=1 $(PKGS)
|
||||||
@golint -set_exit_status=1
|
@go vet $(PKGS)
|
||||||
@go vet .
|
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: ## Run tests with race condition checking.
|
test: ## Run tests with race condition checking.
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// FilePathCompletionSeparator holds separate characters.
|
||||||
FilePathCompletionSeparator = string([]byte{' ', os.PathSeparator})
|
FilePathCompletionSeparator = string([]byte{' ', os.PathSeparator})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,7 @@ package strings
|
||||||
|
|
||||||
import "unicode/utf8"
|
import "unicode/utf8"
|
||||||
|
|
||||||
// IndexNotByte is similar with strings.IndexByte but returns
|
// IndexNotByte is similar with strings.IndexByte but showing the opposite behavior.
|
||||||
// the index of the first instance of character except c in s.
|
|
||||||
// or -1 if s only contains c.
|
|
||||||
func IndexNotByte(s string, c byte) int {
|
func IndexNotByte(s string, c byte) int {
|
||||||
n := len(s)
|
n := len(s)
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
|
@ -15,9 +13,7 @@ func IndexNotByte(s string, c byte) int {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// LastIndexByte is similar with strings.IndexByte but returns
|
// LastIndexNotByte is similar with strings.LastIndexByte but showing the opposite behavior.
|
||||||
// the index of the last instance of character except c in s,
|
|
||||||
// or -1 if s only contains c.
|
|
||||||
func LastIndexNotByte(s string, c byte) int {
|
func LastIndexNotByte(s string, c byte) int {
|
||||||
for i := len(s) - 1; i >= 0; i-- {
|
for i := len(s) - 1; i >= 0; i-- {
|
||||||
if s[i] != c {
|
if s[i] != c {
|
||||||
|
@ -44,9 +40,7 @@ func makeASCIISet(chars string) (as asciiSet, ok bool) {
|
||||||
return as, true
|
return as, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexNotAny is similar with strings.IndexAny but returns
|
// IndexNotAny is similar with strings.IndexAny but showing the opposite behavior.
|
||||||
// the index of the first instance of any Unicode code point from chars in s,
|
|
||||||
// or -1 if no Unicode code point from chars is present in s.
|
|
||||||
func IndexNotAny(s, chars string) int {
|
func IndexNotAny(s, chars string) int {
|
||||||
if len(chars) > 0 {
|
if len(chars) > 0 {
|
||||||
if len(s) > 8 {
|
if len(s) > 8 {
|
||||||
|
@ -76,9 +70,7 @@ func IndexNotAny(s, chars string) int {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// LastIndexAny returns the index of the last instance of any Unicode code
|
// LastIndexNotAny is similar with strings.LastIndexAny but showing the opposite behavior.
|
||||||
// point from chars in s, or -1 if no Unicode code point from chars is
|
|
||||||
// present in s.
|
|
||||||
func LastIndexNotAny(s, chars string) int {
|
func LastIndexNotAny(s, chars string) int {
|
||||||
if len(chars) > 0 {
|
if len(chars) > 0 {
|
||||||
if len(s) > 8 {
|
if len(s) > 8 {
|
||||||
|
|
Loading…
Reference in New Issue