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

x/pkgsite: serve status badge similar to godoc.org #36982

Closed
icza opened this issue Feb 2, 2020 · 17 comments
Closed

x/pkgsite: serve status badge similar to godoc.org #36982

icza opened this issue Feb 2, 2020 · 17 comments

Comments

@icza
Copy link

@icza icza commented Feb 2, 2020

What did you do?

It would be nice to have a badge that can be used on other sites (e.g. github.com) that link to the documentation page of the module / package.

For example, using a URL like this:

https://godoc.org/github.com/icza/bitio?status.svg

Serves an image, a badge which is often used on the package's repository to link to the documentation, like this one:

GoDoc

A similar feature like

https://pkg.go.dev/github.com/icza/bitio?status.svg

Would be useful. Some configuration via URL parameters (like size, color etc) would also be cool.

What did you expect to see?

To have a badge image served similar to godoc.org's response.

What did you see instead?

Request is redirected to https://pkg.go.dev/github.com/icza/bitio?tab=doc and the HTML page is served.

@ALTree ALTree added the pkgsite label Feb 3, 2020
@julieqiu julieqiu changed the title go.dev: Serve status badge similar to godoc.org go.dev: serve status badge similar to godoc.org Feb 3, 2020
@gopherbot gopherbot added this to the Unreleased milestone Feb 6, 2020
@oliverpool
Copy link

@oliverpool oliverpool commented Feb 12, 2020

I just handcrafted a badge on https://shields.io:

go.dev reference

[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/url/of/your-module)

Feel free to tweak the parameters to improve it :-)

The resulting svg could be statically saved somewhere on https://pkg.go.dev (since it is not package dependent).

Edit: use flat-square

peterbourgon added a commit to peterbourgon/ff that referenced this issue Feb 13, 2020
nono added a commit to cozy/cozy-stack that referenced this issue Feb 17, 2020
For the badge, I've used golang/go#36982 (comment)
@integrii
Copy link

@integrii integrii commented Feb 18, 2020

I was able to get a nice badge for flaggy with the following code in my README.md (inspired from @oliverpool above):

<a href="https://pkg.go.dev/github.com/integrii/flaggy"> <img src="https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white"></a>
@julieqiu
Copy link
Contributor

@julieqiu julieqiu commented Feb 28, 2020

Thanks for the suggestions! Our UX team is working on creating a badge for pkg.go.dev documentation reference.

/cc @fflewddur

joeig added a commit to joeig/go-powerdns that referenced this issue Feb 29, 2020
... but keep the current badge, until pkg.go.dev has an official one.
Reference: golang/go#36982
ferhatelmas added a commit to GetStream/stream-go2 that referenced this issue Mar 3, 2020
Didn't update yet: golang/go#36982
@quasilyte
Copy link
Contributor

@quasilyte quasilyte commented Apr 1, 2020

There are tons of godoc badges out there that lead to a site that is basically deprecated.

Is there a reason not to approve the one @oliverpool provided and make it official so everyone can start the migration?

I'm tempted to use it, but if there will be a new recommended badge after several months it will be quite painful to update all README documents again.

Is there a confirmation that an official badge will be provided? I don't want to sound skeptical, but it seems like the priority for this is very low and it can be delayed for ~infinity. :)

Subjectively, it's better to have a "no, unlikely" answer than "yes, there will be" without any guarantees.

@julieqiu
Copy link
Contributor

@julieqiu julieqiu commented Apr 2, 2020

An official badge will be provided - our goal is to have one available in the next month.

maxatome added a commit to maxatome/go-testdeep that referenced this issue Apr 11, 2020
README godoc badge stays bound to godoc.org until golang/go#36982 is
resolved.

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
akshaybabloo added a commit to akshaybabloo/mongo that referenced this issue May 31, 2020
@julieqiu julieqiu changed the title go.dev: serve status badge similar to godoc.org x/pkgsite: serve status badge similar to godoc.org Jun 15, 2020
@lmittmann
Copy link

@lmittmann lmittmann commented Jun 26, 2020

@julieqiu github.com/google/go-cmp is using this shields.io badge which would be a great default badge:

GoDev

libvirtmirror pushed a commit to libvirt/libvirt-go-xml that referenced this issue Jul 8, 2020
The former is the new recommended frontend for browsing Go API
documentation online.

Note that pkg.go.dev doesn't offer status badges at this point in
time[1], so until that feature is introduced we're going to use a
custom badge made using shields.io.

[1] golang/go#36982

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
libvirtmirror pushed a commit to libvirt/libvirt-go that referenced this issue Jul 8, 2020
The former is the new recommended frontend for browsing Go API
documentation online.

Note that pkg.go.dev doesn't offer status badges at this point in
time[1], so until that feature is introduced we're going to use a
custom badge made using shields.io.

[1] golang/go#36982

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 8, 2020

Change https://golang.org/cl/241273 mentions this issue: content/static: add badge generation for package authors

@oliverpool
Copy link

@oliverpool oliverpool commented Jul 8, 2020

You can see the rendered version here: https://www.svgviewer.dev/s/SYc1TNlk

ilammy added a commit to ilammy/themis that referenced this issue Jul 13, 2020
Add a badge for GoThemis as well, leading to our pkg.go.dev page.
Unfortunately, this badge needs to be manually updated with each
release. Though, there is an issue tracking badge generation [1].
There has been some recent progress on it, but who knows when it
lands into production.

[1]: golang/go#36982
ilammy added a commit to cossacklabs/themis that referenced this issue Jul 13, 2020
Add a badge for GoThemis as well, leading to our pkg.go.dev page.
Unfortunately, this badge needs to be manually updated with each
release. Though, there is an issue tracking badge generation [1].
There has been some recent progress on it, but who knows when it
lands into production.

[1]: golang/go#36982
@jamalc
Copy link
Member

@jamalc jamalc commented Jul 14, 2020

You can now generate a badge here: https://pkg.go.dev/badge. I'll update go.dev/about with instructions.

@jamalc
Copy link
Member

@jamalc jamalc commented Jul 14, 2020

🤦 There is a typo in the markdown snippet #40216. I'll post here again once we deploy the fix.

@ryboe
Copy link

@ryboe ryboe commented Jul 14, 2020

Thanks, Go team! 👏

You can generate the badge line yourself by following this template:

[![PkgGoDev](https://pkg.go.dev/badge/<MODULE NAME>)](https://pkg.go.dev/<MODULE NAME>)

For example, the badge for my github.com/ryboe/q repo looks like this:

[![PkgGoDev](https://pkg.go.dev/badge/github.com/ryboe/q)](https://pkg.go.dev/github.com/ryboe/q)
@jamalc
Copy link
Member

@jamalc jamalc commented Jul 15, 2020

The fix for #40216 is out!

@ostcar
Copy link

@ostcar ostcar commented Jul 16, 2020

Thank you for your work!

The description of the form of the badge generator is a bit misleading. The field is called URL so I expected, that a package path with an (https-) schema was requested. It would be nice, if the generator could detect the schema and remove it. Or the field should be renamed to something like package path.

For example I used the URL

https://github.com/ostcar/topic

But correct is

github.com/ostcar/topic
@jamalc
Copy link
Member

@jamalc jamalc commented Jul 16, 2020

Hi, ostcar! 👋

Since this issue is closed please file a new issue here where people can discuss. I have a few thoughts on this as well and the work done here is just a starting point to guide building out this feature.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet