raylib-goplus icon indicating copy to clipboard operation
raylib-goplus copied to clipboard

[QoL] Define a .mod file for raylib-goplus

Open SolarLune opened this issue 5 years ago • 6 comments

The Current Issue Hello!

Thanks for your work on raylib-goplus; it's definitely a huge step in the right direction to automatically generate new bindings for raylib for Go.

When it comes to actually using raylib-goplus, I believe it would be more idiomatic to use Go Modules to allow projects that use this library to download and import it without having to manually run go get, and to make the status of projects that use it reproducible (because it refers to a specific version of a library that is known to work with the project).

The Paradigm to Match Instead of running go get on a library (raylib-goplus, in this case), just importing it should have Go automatically download and include it in the project's go.mod file, due to the library having the go.mod file included.

The Proposal To fix this, simply initialize a new module with the project's name / URL using go mod init and commit it to the root of the module. This will allow recent Go versions to automatically retrieve it from the URL specified, download it, and import it without issue.

SolarLune avatar Mar 12 '20 18:03 SolarLune

Great suggestion. I will do this tonight (if I remember).

Lachee avatar Mar 12 '20 22:03 Lachee

This now has been implemented

Lachee avatar Apr 25 '20 04:04 Lachee

I believe there's an issue with the go.mod file...

EDIT: OK, I figured out why this wasn't working. You have multiple go.mod files in your subdirectories. There should only be one, in the base folder for the project. From that point, the folder structure indicates the packages; you specifically should not have multiple go.mod files in your project.

SolarLune avatar Apr 25 '20 05:04 SolarLune

oooh, from the guide I was following, it suggested to use multiple go mod files. Alright, I will correct this now :)

Lachee avatar Apr 26 '20 01:04 Lachee

Can you tell me which guide this is? Maybe it was talking about something else...?

SolarLune avatar Apr 27 '20 06:04 SolarLune

https://github.com/go-modules-by-example/index/tree/master/009_submodules

Lachee avatar Apr 27 '20 06:04 Lachee