style: add gosimple linter and gofmt linter (#1242)

pull/1247/head
喵喵大人 3 years ago committed by GitHub
parent f872ec4685
commit d09ba5e3ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .golangci.yml
  2. 2
      metadata/metadata.go
  3. 2
      transport/http/binding/encode.go

@ -9,3 +9,5 @@ linters:
- revive - revive
- staticcheck - staticcheck
- govet - govet
- gosimple
- gofmt

@ -47,7 +47,7 @@ func (m Metadata) Set(key string, value string) {
func (m Metadata) Range(f func(k, v string) bool) { func (m Metadata) Range(f func(k, v string) bool) {
for k, v := range m { for k, v := range m {
ret := f(k, v) ret := f(k, v)
if ret == false { if !ret {
break break
} }
} }

@ -28,7 +28,7 @@ func EncodeURL(pathTemplate string, msg proto.Message, needQuery bool) string {
if reg == nil { if reg == nil {
return pathTemplate return pathTemplate
} }
pathParams := make(map[string]struct{}, 0) pathParams := make(map[string]struct{})
path := reg.ReplaceAllStringFunc(pathTemplate, func(in string) string { path := reg.ReplaceAllStringFunc(pathTemplate, func(in string) string {
if len(in) < 4 { if len(in) < 4 {
return in return in

Loading…
Cancel
Save