Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More initialism corrections (golint) #970

Closed
wants to merge 2 commits into from

Conversation

anthonyfok
Copy link
Member

Deal with Url -> URL and BaseUrl -> BaseURL conversion
while preserving backward compatibility, and marking
relevant lines deprecated.

Also fix related initialisms in strings and comments.

Continued effort in fixing #959.

@bep bep assigned bep and anthonyfok and unassigned bep Mar 12, 2015
@bep
Copy link
Member

bep commented Mar 12, 2015

See 6e30c10

To communicate these changes to the users, I think it is better to create temporary methods on the structs for the renamed fields and methods, like this:

// Url is deprecated. Will be removed in 0.15.
func (p *pager) Url() template.HTML {
    helpers.Deprecated("Paginator", "Url", "URL")
    return p.URL()
}

@anthonyfok
Copy link
Member Author

@bep Thank you for authoring helpers.Deprecated() and showing me how to use it. It has been a great learning experience!

I need to leave the house in an hour though. I hope to find time tonight (12 hours from now?) to study and incorporate your example to deprecated struct fields. :-)

@bep
Copy link
Member

bep commented Mar 12, 2015

No rush. Note that, from the template's point of view, a method will look (almost) like a field, so the above should work for both cases.

@anthonyfok anthonyfok force-pushed the golint-initialisms branch 2 times, most recently from 2715302 to 92ae298 Compare March 18, 2015 04:55
@anthonyfok
Copy link
Member Author

Hi @bep!

You are brilliant! And so is your helpers.Deprecated() function! It is such a joy to use! It makes the transition so much cleaner too!

I have just pushed 92ae298; please check and see if it is OK.

I will update the docs soon. :-)

Thanks again!

Thanks to @bep's new, brilliant helpers.Deprecated() function,
the following functions or variables are transitioned to their
new names, preserving backward compatibility for v0.14
and warning the user of upcoming obsolescence in v0.15:

 * .Url → .URL (for node, menu and paginator)
 * .Site.BaseUrl → .Site.BaseURL
 * .Site.Indexes → .Site.Taxonomies
 * .Site.Recent → .Site.Pages
 * getJson → getJSON
 * getCsv → getCSV
 * safeHtml → safeHTML
 * safeCss → safeCSS
 * safeUrl → safeURL

Also fix related initialisms in strings and comments.

Continued effort in fixing gohugoio#959.
In particular:

 * .Url → .URL (for node, menu and paginator)
 * .Site.BaseUrl → .Site.BaseURL
 * getJson → getJSON
 * getCsv → getCSV
 * safeHtml → safeHTML
 * safeCss → safeCSS
 * safeUrl → safeURL

Continued effort in fixing gohugoio#959.
@bep
Copy link
Member

bep commented Mar 18, 2015

Merged. Quality work!

I may be a person who thinks this is more important than the average developer Joe, but if you don't pull the tech debt by the horns, you get a legacy system pretty fast.

@bep bep closed this Mar 18, 2015
@anthonyfok anthonyfok deleted the golint-initialisms branch December 19, 2015 19:04
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants