소스 검색

[GIN] Fix minor lint errors

- unchecked errors solved as in upstream file internal/route/api/v1/misc/markdown.go
- resolved make(...) in internal/route/search_gin.go according to  linter suggestion
- simplified string handling in internal/markup/odml.go as in linter suggestion
M. Sonntag 4 년 전
부모
커밋
ec8efcf705

+ 2 - 2
internal/markup/odml.go

@@ -14,7 +14,7 @@ func MarshalODML(buf []byte) []byte {
 	od := Odml{}
 	decoder := xml.NewDecoder(bytes.NewReader(buf))
 	decoder.CharsetReader = charset.NewReaderLabel
-	decoder.Decode(&od)
+	_ = decoder.Decode(&od)
 	data, _ := json.Marshal(od)
 	return data
 }
@@ -57,7 +57,7 @@ func (u *Property) MarshalJSON() ([]byte, error) {
 func (u *Section) MarshalJSON() ([]byte, error) {
 	type Alias Section
 	if u.Text == "" {
-		u.Text = fmt.Sprintf("%s", u.Name)
+		u.Text = u.Name
 	}
 	for _, x := range u.Properties {
 		u.Children = append(u.Children, OdMLObject{Prop: x, Type: "property"})

+ 1 - 1
internal/route/api/v1/misc/client.go

@@ -34,5 +34,5 @@ func ClientC(c *context.APIContext) {
 		return
 	}
 	c.WriteHeader(http.StatusOK)
-	c.Write(data)
+	_, _ = c.Write(data)
 }

+ 1 - 1
internal/route/api/v1/search/general.go

@@ -39,5 +39,5 @@ func Search(c *context.APIContext) {
 		c.Status(http.StatusInternalServerError)
 		return
 	}
-	c.Write(data)
+	_, _ = c.Write(data)
 }

+ 1 - 1
internal/route/api/v1/search/suggest.go

@@ -35,5 +35,5 @@ func Suggest(c *context.APIContext) {
 		c.Status(http.StatusInternalServerError)
 		return
 	}
-	c.Write(data)
+	_, _ = c.Write(data)
 }

+ 1 - 1
internal/route/search_gin.go

@@ -22,7 +22,7 @@ const (
 type set map[int64]interface{}
 
 func newset() set {
-	return make(map[int64]interface{}, 0)
+	return make(map[int64]interface{})
 }
 
 func (s set) add(item int64) {