mirror of
https://github.com/rancher/norman.git
synced 2025-09-01 07:08:59 +00:00
Fix golangci-lint issues
As part of updating dapper files, golangci-lint was set to be used. This caused a lot of lint issues to crop up, which this fixes.
This commit is contained in:
@@ -103,7 +103,7 @@ func Parse(rw http.ResponseWriter, req *http.Request, schemas *types.Schemas, ur
|
||||
result.URLBuilder, err = urlbuilder.New(req, types.APIVersion{}, result.Schemas)
|
||||
result.Type = "apiRoot"
|
||||
result.Schema = result.Schemas.Schema(&builtin.Version, "apiRoot")
|
||||
return result, nil
|
||||
return result, err
|
||||
}
|
||||
|
||||
result.URLBuilder, err = urlbuilder.New(req, *result.Version, result.Schemas)
|
||||
@@ -169,9 +169,7 @@ func parseVersionAndSubContext(schemas *types.Schemas, escapedPath string) (*typ
|
||||
}
|
||||
version := &versions[0]
|
||||
|
||||
if strings.HasSuffix(escapedPath, "/") {
|
||||
escapedPath = escapedPath[:len(escapedPath)-1]
|
||||
}
|
||||
escapedPath = strings.TrimSuffix(escapedPath, "/")
|
||||
|
||||
versionParts := strings.Split(version.Path, "/")
|
||||
pp := strings.Split(escapedPath, "/")
|
||||
@@ -295,7 +293,10 @@ func parseAction(url *url.URL) (string, string) {
|
||||
}
|
||||
|
||||
func Body(req *http.Request) (map[string]interface{}, error) {
|
||||
req.ParseMultipartForm(maxFormSize)
|
||||
err := req.ParseMultipartForm(maxFormSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req.MultipartForm != nil {
|
||||
return valuesToBody(req.MultipartForm.Value), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user