go-gl / mathgl

A pure Go 3D math library.
BSD 3-Clause "New" or "Revised" License
554 stars 65 forks source link

Make repo friendly to standard `go generate ./...`. #47

Closed dmitshur closed 9 years ago

dmitshur commented 9 years ago

Currently, the standard way to generate this repo is to run go generate github.com/go-gl/mathgl/mgl32. It generates parts of mgl32 package, and all of mg64 package. In the process of generating mg64, it copies over the go generate directives. But they are invalid, and running go generate github.com/go-gl/mathgl/mgl64 produces an error. Doing that should be a safe no-op.

This change fixes that by replacing "//go:generate " directives with a disabled version "//#go:generate " when copying over mgl32 files to mgl64 package.

As a result, doing go generate github.com/go-gl/mathgl/... works as expected without problems and correctly generates all packages in this repo.

Hopefully it'll help avoid issues like https://github.com/go-gl/mathgl/pull/46#issuecomment-133938858 and make contributing slightly easier.

ghost commented 9 years ago

regarding issue #46, i ran go run codegen.go -template matrix.tmpl -output matrix.go which didnt generate mgl64. go generate didn't fail to generate mgl64, I ran the wrong command.

dmitshur commented 9 years ago

Makes sense.

Hopefully this will improve the situation a little by making it easier to run go generate, no need to worry about accidentally running it on the mgl64 package (if you forget if you should or should not) and getting an error message.

Can this be merged?

ghost commented 9 years ago

ya, SGTM, :shipit: