-
Notifications
You must be signed in to change notification settings - Fork 780
Conversation
Thanks, @sbinet. Go modules are new to me -- where can I read up on them? Do they pose a problem for people using older versions of Go? |
the initial overview is there: Dave Cheney has a little tutorial there as well: and I also noticed this slightly more complete intro: finally, there's the official WIP documentation: theoretically, adding this file shouldn't impact users (as long as we don't use "modules" semantics. we don't yet.) |
Thanks for the links. I think the new module scheme provides a welcome remedy for problems caused by the GOPATH environment variable. One of my goals with gofpdf is to keep it dependent only on the standard library. The motivation for the contrib directory was to isolate any add-ons that had outside dependencies. Consequently, I think a problem with your go.mod is that it requires packages like github.com/boombuler/barcode at too high a directory level. This should be required only for builds that will actually use barcodes. If I understand modules correctly, go will look for go.mod in the current build directory, then the parent, then the grandparent, etc. I think it makes sense to put a tailor-made go.mod in the contrib subdirectories and require only the packages that are specifically needed. Also, I don't recognize github.com/pmezard/go-difflib and github.com/stretchr/testify. Are they packages that you think will improve testing? |
these packages are marked as
gotcha. I'll try that. |
ok. I just dropped the extra deps of |
Thanks, @sbinet! |
Hi,
Moreover, that package has go.mod in the master branch but not in the latest release. Any suggestion @jung-kurt , @sbinet? |
Is this a consequence of having the contrib subdirectory be a member of the main gofpdf directory? Would the problem be corrected if the contrib tree was moved to its own repository? If so, I would rather do this than make the main project be dependent on third party libraries. |
Yes, it is possible to move contrib to a separate repo or to move the |
I fear changing the import path of the gofpdf package would break a lot of projects. I favor moving the contrib to its own repository. Can commit history for the contrib files be carried over if that is done? |
I'm sorry @jung-kurt , I forgot about the question. |
Thanks. Yes, I think a new issue makes sense. |
Versioning allows us to make breaking changes. A major version bump indicates a breaking API change such as changing the import paths. Therefore, I think it's fine to change some import paths as long as it's done with a major version bump. Therefore I recommend:
Existing users who already use a module versioning system (go modules, dep, vendoring, Bazel, or whatever) will be unaffected by the change and can migrate from A to B at their leisure. Changing a few import paths is quite trivial and can be done in a line or two of |
Many thanks for the well-reasoned road map and for the git instructions. This looks good to me and I will try to get to it this weekend. |
That would be fantastic, many thanks for your work :) |
I have split off the contrib directory to gofpdfcontrib. Also, I created a v2 branch of gofpdf with the contrib directory removed and documentation adjusted accordingly. The v2 bump is needed because gofpdf was already tagged at 1.x.y, and this change with contributed packages breaks compatibility. I think the remaining steps include tagging a v2 release and setting the v2 branch as the default. (Alternatively, the v2 branch could be merged into master.) My questions relate to how go interacts with git.
|
As a followup: I have edited the go.mod file to include the /v2 suffix:
This is part of the new v2 branch. The files in gofpdfcontrib have been updated to import The default branch will continue to be master (not v2) so that $GOPATH users won't see any change. Bug fixes will be made there and in v2, but new functionality will go only into v2. |
IIRC, latest patch versions of 1.9 and 1.10 have support for the "github.com/jung-kurt/gofpdf/v2" import paths. |
My thought in keeping v2 out of master for awhile is to let GOPATH users who import contrib/barcode from getting an error. Does github provide any metric on the number of users this is? |
I don't think github does. |
Had I thought about that, I wouldn't have been able to tease part users of barcode from gofpdf anyway.
Not a ton of packages. Maybe it just makes sense to document the change and make the merge. |
yep, but the packages godoc mentions are only the packages (that import barcode and) for which the documentation has been accessed through godoc. |
After v2 is merged into master, programs that use the barcode package will get the following compilation error:
This won't be too informative for those users, but if they refer back to the README they will see that the remedy is simple enough (changing |
No description provided.