Correct initialisms as suggested by golint

First step to use initialisms that golint suggests,
for example:

    Line 116: func GetHtmlRenderer should be GetHTMLRenderer

as see on http://goreportcard.com/report/spf13/hugo

Thanks to @bep for the idea!

Note that command-line flags (cobra and pflag)
as well as struct fields like .BaseUrl and .Url
that are used in Go HTML templates need more work
to maintain backward-compatibility, and thus
are NOT yet dealt with in this commit.

First step in fixing #959.
This commit is contained in:
Anthony Fok 2015-03-11 11:34:57 -06:00 committed by bep
parent 00f07c5374
commit 67df33f500
33 changed files with 310 additions and 303 deletions

View file

@ -84,11 +84,11 @@ func server(cmd *cobra.Command, args []string) {
viper.Set("port", serverPort)
BaseUrl, err := fixUrl(BaseUrl)
BaseURL, err := fixURL(BaseURL)
if err != nil {
jww.ERROR.Fatal(err)
}
viper.Set("BaseUrl", BaseUrl)
viper.Set("BaseURL", BaseURL)
if err := memStats(); err != nil {
jww.ERROR.Println("memstats error:", err)
@ -114,9 +114,9 @@ func serve(port int) {
httpFs := &afero.HttpFs{SourceFs: hugofs.DestinationFS}
fileserver := http.FileServer(httpFs.Dir(helpers.AbsPathify(viper.GetString("PublishDir"))))
u, err := url.Parse(viper.GetString("BaseUrl"))
u, err := url.Parse(viper.GetString("BaseURL"))
if err != nil {
jww.ERROR.Fatalf("Invalid BaseUrl: %s", err)
jww.ERROR.Fatalf("Invalid BaseURL: %s", err)
}
if u.Path == "" || u.Path == "/" {
http.Handle("/", fileserver)
@ -137,10 +137,10 @@ func serve(port int) {
// fixUrl massages the BaseUrl into a form needed for serving
// all pages correctly.
func fixUrl(s string) (string, error) {
func fixURL(s string) (string, error) {
useLocalhost := false
if s == "" {
s = viper.GetString("BaseUrl")
s = viper.GetString("BaseURL")
useLocalhost = true
}
if !strings.HasPrefix(s, "http://") && !strings.HasPrefix(s, "https://") {