Lachee / raylib-goplus

A newer version of the Go bindings for Raylib
zlib License
76 stars 6 forks source link

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

Open SolarLune opened 4 years ago

SolarLune commented 4 years ago

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.

Lachee commented 4 years ago

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

Lachee commented 4 years ago

This now has been implemented

SolarLune commented 4 years ago

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.

Lachee commented 4 years ago

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

SolarLune commented 4 years ago

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

Lachee commented 4 years ago

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