chore(style): use gofumpt to fmt go code (#967)

This commit is contained in:
q1anx1
2022-08-07 12:26:14 +08:00
committed by GitHub
parent 45d2745b67
commit 2ea58cd639
63 changed files with 172 additions and 188 deletions

View File

@ -32,7 +32,7 @@ func GetIPInfo(clientIP string) string {
res := ""
for i := range ips {
ip := strings.TrimSpace(ips[i])
//desc := GetDescFromIP(ip)
// desc := GetDescFromIP(ip)
ipstr := fmt.Sprintf("%s: %s", ip, "")
if i != len(ips)-1 {
res += ipstr + " -> "

View File

@ -19,8 +19,10 @@ import (
"regexp"
)
var rePhoneCn *regexp.Regexp
var rePhone *regexp.Regexp
var (
rePhoneCn *regexp.Regexp
rePhone *regexp.Regexp
)
func init() {
// https://learnku.com/articles/31543

View File

@ -69,7 +69,7 @@ func BoolToString(b bool) string {
return "0"
}
//CamelToSnakeCase This function transform camelcase in snakecase LoremIpsum in lorem_ipsum
// CamelToSnakeCase This function transform camelcase in snakecase LoremIpsum in lorem_ipsum
func CamelToSnakeCase(camel string) string {
var buf bytes.Buffer
for _, c := range camel {
@ -177,7 +177,7 @@ func ReadStringFromPath(path string) string {
}
func WriteStringToPath(s string, path string) {
err := ioutil.WriteFile(path, []byte(s), 0644)
err := ioutil.WriteFile(path, []byte(s), 0o644)
if err != nil {
panic(err)
}

View File

@ -15,9 +15,10 @@
package util
import (
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"testing"
)
func TestParseInt(t *testing.T) {
@ -245,4 +246,3 @@ func TestSnakeString(t *testing.T) {
})
}
}

View File

@ -31,7 +31,6 @@ func Test_GetCurrentTime(t *testing.T) {
types := reflect.TypeOf(test).Kind()
assert.Equal(t, types, reflect.String, "GetCurrentUnixTime should be return string")
}
func Test_GetCurrentUnixTime_Shoud_Return_String(t *testing.T) {
@ -41,7 +40,6 @@ func Test_GetCurrentUnixTime_Shoud_Return_String(t *testing.T) {
}
func Test_IsTokenExpired(t *testing.T) {
type input struct {
createdTime string
expiresIn int