Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ab6d16a

Browse filesBrowse files
author
Timo Gatsonides
committed
Simplify code
1 parent 8f5aad1 commit ab6d16a
Copy full SHA for ab6d16a

File tree

Expand file treeCollapse file tree

2 files changed

+3
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-7
lines changed

‎router.go

Copy file name to clipboardExpand all lines: router.go
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,7 @@ func parseRoutes(routesPath, joinedPath, content string, validate bool) ([]*Rout
205205
if strings.HasSuffix(joinedPath, "/") && strings.HasPrefix(path, "/") {
206206
joinedPath = joinedPath[0 : len(joinedPath)-1]
207207
}
208-
if AppRoot == "" {
209-
path = strings.Join([]string{joinedPath, path}, "")
210-
} else {
211-
path = strings.Join([]string{AppRoot, joinedPath, path}, "")
212-
}
208+
path = strings.Join([]string{AppRoot, joinedPath, path}, "")
213209

214210
// This will import the module routes under the path described in the
215211
// routes file (joinedPath param). e.g. "* /jobs module:jobs" -> all

‎template.go

Copy file name to clipboardExpand all lines: template.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,10 @@ func ReverseUrl(args ...interface{}) (template.URL, error) {
397397
}
398398

399399
action := args[0].(string)
400-
actionSplit := strings.Split(action, ".")
401-
if len(actionSplit) == 1 && actionSplit[0] == "Root" {
400+
if action == "Root" {
402401
return template.URL(AppRoot), nil
403402
}
403+
actionSplit := strings.Split(action, ".")
404404
if len(actionSplit) != 2 {
405405
return "", fmt.Errorf("reversing '%s', expected 'Controller.Action'", action)
406406
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.