summaryrefslogtreecommitdiffstats
path: root/helpers/url.go
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-03-07 00:02:06 +0100
committerbep <bjorn.erik.pedersen@gmail.com>2015-03-07 00:02:06 +0100
commitbd2b679eaf45669e23a724a5dacd5421c5ec61e1 (patch)
treeb17d13faab28086195701c56e54fe34dd1a86f3c /helpers/url.go
parente685dfc0c607b3051dbac29e1209900e58de1605 (diff)
helpers: apply some Golint rules
Diffstat (limited to 'helpers/url.go')
-rw-r--r--helpers/url.go45
1 files changed, 21 insertions, 24 deletions
diff --git a/helpers/url.go b/helpers/url.go
index f31e7a4e1..b3b9779c3 100644
--- a/helpers/url.go
+++ b/helpers/url.go
@@ -172,18 +172,17 @@ func UrlPrep(ugly bool, in string) string {
if ugly {
x := Uglify(SanitizeUrl(in))
return x
- } else {
- x := PrettifyUrl(SanitizeUrl(in))
- if path.Ext(x) == ".xml" {
- return x
- }
- url, err := purell.NormalizeURLString(x, purell.FlagAddTrailingSlash)
- if err != nil {
- fmt.Printf("ERROR returned by NormalizeURLString. Returning in = %q\n", in)
- return in
- }
- return url
}
+ x := PrettifyUrl(SanitizeUrl(in))
+ if path.Ext(x) == ".xml" {
+ return x
+ }
+ url, err := purell.NormalizeURLString(x, purell.FlagAddTrailingSlash)
+ if err != nil {
+ fmt.Printf("ERROR returned by NormalizeURLString. Returning in = %q\n", in)
+ return in
+ }
+ return url
}
// PrettifyUrl takes a URL string and returns a semantic, clean URL.
@@ -221,19 +220,17 @@ func Uglify(in string) string {
}
// /section/name/ -> /section/name.html
return path.Clean(in) + ".html"
- } else {
- name, ext := FileAndExt(in, pathBridge)
- if name == "index" {
- // /section/name/index.html -> /section/name.html
- d := path.Dir(in)
- if len(d) > 1 {
- return d + ext
- } else {
- return in
- }
- } else {
- // /section/name.html -> /section/name.html
- return path.Clean(in)
+ }
+
+ name, ext := FileAndExt(in, pathBridge)
+ if name == "index" {
+ // /section/name/index.html -> /section/name.html
+ d := path.Dir(in)
+ if len(d) > 1 {
+ return d + ext
}
+ return in
}
+ // /section/name.html -> /section/name.html
+ return path.Clean(in)
}