openSUSE / obs-service-go_modules

OBS Source Service to download, verify, and vendor Go module dependency sources
GNU General Public License v2.0
19 stars 17 forks source link

Add --subdir argument to allow for go.mod files in different locations & numerous fixes #15

Closed e4t closed 1 year ago

e4t commented 3 years ago

Some Go projects may have sub-projects that are build independently. These come in subdirectories with their own go.mod. Allow to specify the directory where to search for a go.mod file.

While testing this there were numerous other issues which had to be addressed as well:

e4t commented 2 years ago

@aplanas - Thanks! I've updated the code following your suggestions. Two patches were obsolete. I did read the documentation on TemporaryDirectory: this is where it talks about the exception generated on error during cleanup (unless ignore_cleanup_errors is set) - I hadn't looked at the code, though. I've also simplified the changes to find_file() - I haven't found more useful os.path calls, however, the intentions should be a bit more clear, now.

aplanas commented 2 years ago

@e4t thanks!

@jfkw Can you review the change?

e4t commented 2 years ago

After chatting with Jeff I've decided to rework my patches again. Searching for the go.mod file may not render the correct result - especially if there are more such files around and the subdir mechanism used is not totally fool-proof. It seems to be better to look for it in the topmost directory only and expect the user to provide the directory explicitly if it is not here (or another one is to be used).

jfkw commented 1 year ago

Thank you for the contributed fixes and the new --subdir argument. I have added one commit to make that argument optional, and tested it with a number of Go application packages with success.

These commits will be the next tagged release landing presently.

e4t commented 1 year ago

Thank you for the contributed fixes and the new --subdir argument. I have added one commit to make that argument optional, and tested it with a number of Go application packages with success.

Good point! Thank you!

These commits will be the next tagged release landing presently.

Thank you for the update!