fix by golint (#1822)

This commit is contained in:
fatedier
2020-05-24 17:48:37 +08:00
committed by GitHub
parent 2170c481ce
commit 8b75b8b837
80 changed files with 1315 additions and 1324 deletions

View File

@@ -23,13 +23,13 @@ import (
"strings"
)
// RandId return a rand string used in frp.
func RandId() (id string, err error) {
return RandIdWithLen(8)
// RandID return a rand string used in frp.
func RandID() (id string, err error) {
return RandIDWithLen(8)
}
// RandIdWithLen return a rand string with idLen length.
func RandIdWithLen(idLen int) (id string, err error) {
// RandIDWithLen return a rand string with idLen length.
func RandIDWithLen(idLen int) (id string, err error) {
b := make([]byte, idLen)
_, err = rand.Read(b)
if err != nil {
@@ -105,7 +105,6 @@ func ParseRangeNumbers(rangeStr string) (numbers []int64, err error) {
func GenerateResponseErrorString(summary string, err error, detailed bool) string {
if detailed {
return err.Error()
} else {
return summary
}
return summary
}

View File

@@ -8,7 +8,7 @@ import (
func TestRandId(t *testing.T) {
assert := assert.New(t)
id, err := RandId()
id, err := RandID()
assert.NoError(err)
t.Log(id)
assert.Equal(16, len(id))