dgrijalva / jwt-go

ARCHIVE - Golang implementation of JSON Web Tokens (JWT). This project is now maintained at:
https://github.com/golang-jwt/jwt
MIT License
10.79k stars 995 forks source link

Docs: Add imports to all example snippets #349

Open RavenHursT opened 5 years ago

RavenHursT commented 5 years ago

Would be nice to have all the snippets in the documentation have complete import statements of all the packages referenced in each snippet code.

When a new Gopher comes along, trying to learn, and comes across a snippet like below.. It makes it really tough when snippets like this can't just be copy/pasted into things like, https://play.golang.org/ w/o first investigating and figuring out which packages need to be included.

There's nothing in the code snippet to explicitly tell the Gopher where things like, http, mux, bytes, strings, jwt, fmt, etc are coming from.

I know to a lot of seasoned folks, these things may seem "obvious" to them... But to new Gophers trying to learn how to use Golang, it's a big stumbling block...

image

ygj6 commented 4 years ago

Indeed, it will confuse beginners