You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 1, 2020. It is now read-only.
I frequently find myself pasting example links from github to demonstrate something I've written or point out something in #reviews. Less frequently I find myself editing my slack posts to replace https://github.com/therealplato/shortlink/blob/master/config.go#L10 with https://github.com/therealplato/shortlink/blob/b4821cb7375cc6afaae61ebd6515c71a5fd32635/config.go#L10.
The latter link is preferable if future searchers are trying to understand the point of discussion, as the former link will probably point to different code soon. Gopher could help me catch any links I forget to permalink myself.
Something like:
varGithubCode=regexp.MustCompile(`https://github.com/[^/]/[^/]/blob/master/[^ ]*#L[L0-9\-]+`)
varHasPermalink=regexp.MustCompile(`blob/[0-9a-f]{32}`)
...ifGithubCode.MatchString(msg) {
link:=GithubCode.FindString(msg)
if!IsPermalink.MatchString(msg) {
// permalink := acquirePermalink(msg)bot.ReplyDM(msg, "I saw you linked %s, which looks like it's pointing to specific code on a branch or tag. It's not unusual for those refs to eventually point to different code, so this link might not be useful to gophers who read this later. If you'd like the link to work in the future, press `y` on that page and edit the new link.", link)
}
Preemptively yes, regex are relatively difficult to read and debug, I find them great for rapid prototyping though :)
Do you think the more usable search history is worth the annoyance costs of getting DM's from gopher?
The text was updated successfully, but these errors were encountered:
It could reply to the original message with the permalink (i.e. create a thread). I don't think I'd like to get a DM anyway as it takes me out of the context of the convo.
I frequently find myself pasting example links from github to demonstrate something I've written or point out something in #reviews. Less frequently I find myself editing my slack posts to replace
https://github.com/therealplato/shortlink/blob/master/config.go#L10
withhttps://github.com/therealplato/shortlink/blob/b4821cb7375cc6afaae61ebd6515c71a5fd32635/config.go#L10
.The latter link is preferable if future searchers are trying to understand the point of discussion, as the former link will probably point to different code soon. Gopher could help me catch any links I forget to permalink myself.
Something like:
Preemptively yes, regex are relatively difficult to read and debug, I find them great for rapid prototyping though :)
Do you think the more usable search history is worth the annoyance costs of getting DM's from gopher?
The text was updated successfully, but these errors were encountered: