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

Nice error message if go.mod does not contain dependencies #52

Open johanneskastl opened 2 months ago

johanneskastl commented 2 months ago

I would propose that the service errors out with a useful message instead of this if the go.mod file does not have any dependencies in it:

Example: https://github.com/minio/certgen/blob/main/go.mod

module github.com/minio/certgen

go 1.21
INFO:obs-service-go_modules:Vendor go.mod dependencies to vendor.tar.gz
Traceback (most recent call last):
  File "/usr/lib/obs/service/go_modules", line 322, in <module>
    main()
  File "/usr/lib/obs/service/go_modules", line 315, in main
    new_archive.add_files(vendor_dir)
  File "/usr/lib/python3.11/site-packages/libarchive/write.py", line 84, in add_files
    r = read_next_header2(read_p, entry_p)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libarchive/ffi.py", line 98, in check_int
    raise archive_error(args[0], retcode)
libarchive.exception.ArchiveError: vendor: Cannot stat (errno=2, retcode=-25, archive_p=94160168216544)

(The output was achieved when using the modified service from #51, otherwise it never reaches the actual go step)