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

Proposal: Rename repository to "example". #58

Closed
dmitshur opened this issue May 1, 2017 · 6 comments
Closed

Proposal: Rename repository to "example". #58

dmitshur opened this issue May 1, 2017 · 6 comments

Comments

@dmitshur
Copy link
Member

dmitshur commented May 1, 2017

This repo contains examples of usage, and I'd like it to set the best possible example.

Yet the repo's name is deviating slightly from idiomatic Go naming patterns. It should be singular "example" rather than "examples", so that the import path "example/name-of-example" reads more cleanly, and for consistency.

See https://dmitri.shuralyov.com/idiomatic-go#use-singular-form-for-collection-repo-folder-name for rationale.

If there are no objections, I'd like to rename it to follow idiomatic Go style and set a better example. GitHub will setup redirects from old repo name, so it should be fairly harmless.

/cc @tapir @slimsag

@slimsag
Copy link
Member

slimsag commented May 1, 2017

No objection.

If there are no objections, I'd like to rename it to follow idiomatic Go style and set a better example. GitHub will setup redirects from old repo name, so it should be fairly harmless.

Just to be clear, we won't allow people to still go get github.com/go-gl/examples, right? I think it would be a mistake to support two import paths.

@dmitshur
Copy link
Member Author

dmitshur commented May 1, 2017

That's right. The import paths will be changed to github.com/go-gl/example/..., and I'll update all instances where they're mentioned in the README.

The supported redirects are just for people visiting the https://github.com/go-gl/examples webpage in their browser.

@tapir
Copy link
Member

tapir commented May 1, 2017

👍 no objection here as well.

dmitshur added a commit that referenced this issue May 1, 2017
dmitshur added a commit that referenced this issue May 1, 2017
@slimsag
Copy link
Member

slimsag commented May 1, 2017

@shurcooL I think we should add import path checking to the example commands as part of this. I can still go get -v github.com/go-gl/examples/... freely:

$ rm -rf /Users/stephen/Desktop/godev/src/github.com/go-gl/examples/
$ go get -v github.com/go-gl/examples/...
github.com/go-gl/examples (download)
github.com/go-gl/gl (download)
github.com/go-gl/glfw (download)
github.com/go-gl/mathgl (download)
Fetching https://golang.org/x/image/math/f32?go-get=1
Parsing meta tags from https://golang.org/x/image/math/f32?go-get=1 (status code 200)
get "golang.org/x/image/math/f32": found meta tag main.metaImport{Prefix:"golang.org/x/image", VCS:"git", RepoRoot:"https://go.googlesource.com/image"} at https://golang.org/x/image/math/f32?go-get=1
get "golang.org/x/image/math/f32": verifying non-authoritative meta tag
Fetching https://golang.org/x/image?go-get=1
Parsing meta tags from https://golang.org/x/image?go-get=1 (status code 200)
golang.org/x/image (download)
github.com/go-gl/gl/v2.1/gl
github.com/go-gl/glfw/v3.2/glfw
golang.org/x/image/math/f32
github.com/go-gl/gl/v4.1-core/gl
github.com/go-gl/mathgl/mgl32
github.com/go-gl/examples/gl41core-cube
github.com/go-gl/examples/gl21-cube

In effect, we're still supporting both import paths, which IMO is bad.

@slimsag slimsag reopened this May 1, 2017
@dmitshur
Copy link
Member Author

dmitshur commented May 1, 2017

In effect, we're still supporting both import paths, which IMO is bad.

I don't see that as us supporting both import paths. The old one just happens to work with go get, but it's not actually supported by us. The actual program won't work, you'll get an error:

2017/05/01 18:41:20 Unable to find Go package in your GOPATH, it's needed to load assets: cannot find package "github.com/go-gl/example/gl41core-cube" in any of:
	/usr/local/go/src/github.com/go-gl/example/gl41core-cube (from $GOROOT)
	/tmp/gopath/src/github.com/go-gl/example/gl41core-cube (from $GOPATH)

But, I'm okay with adding import comments, then the error will happen at go get time and maybe it's more clear.

dmitshur added a commit that referenced this issue May 1, 2017
The repository has been recently renamed from "examples" to "example"
in #58. Help make the new expected import path more clear by adding
import comments. Reference: https://golang.org/cmd/go/#hdr-Import_path_checking.

This way, the expected import path is visible in the source code, in
addition to README. It also gives a better error message when trying
to go get or go install the package with incorrect old import path.

Closes #58 (again).
dmitshur added a commit that referenced this issue May 1, 2017
The repository has been recently renamed from "examples" to "example"
in #58. Help make the new expected import path more clear by adding
import comments. (Reference: https://golang.org/cmd/go/#hdr-Import_path_checking.)

This way, the expected import path is visible in the source code, in
addition to README. It also gives a better error message when trying
to go get or go install the package with incorrect old import path.

Closes #58 (again).
@slimsag
Copy link
Member

slimsag commented May 2, 2017

I missed that the program wouldn't work, because I'd already fetched example into my GOPATH, so it was pulling assets from there despite me running a binary compiled from examples -- that's one confusing situation that could be avoided with the import path comments :)

PR LGTM

dmitshur added a commit that referenced this issue May 2, 2017
The repository has been recently renamed from "examples" to "example"
in #58. Help make the new expected import path more clear by adding
import comments. (Reference: https://golang.org/cmd/go/#hdr-Import_path_checking.)

This way, the expected import path is visible in the source code, in
addition to README. It also gives a better error message when trying
to go get or go install the package with incorrect old import path.

Closes #58 (again).
dmitshur added a commit to go-gl/gl that referenced this issue Jun 19, 2017
The old link still worked thanks to the GitHub redirect, but it's better to point
to the new repo directly.

Updates go-gl/example#58.
Follows #78.
errcw pushed a commit to go-gl/gl that referenced this issue Jun 20, 2017
The old link still worked thanks to the GitHub redirect, but it's better to point
to the new repo directly.

Updates go-gl/example#58.
Follows #78.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants