DHowett / go-plist

A pure Go Apple Property List transcoder
Other
416 stars 97 forks source link

Fix go.mod to make module importable #41

Closed FabienM closed 5 years ago

FabienM commented 5 years ago

Currently, module is not importable:

$ go mod download
go: github.com/DHowett/go-plist@v0.0.0-20181124034731-591f970eefbb: parsing go.mod: unexpected module path "howett.net/plist"

This commit should fix this.

Regards,

DHowett commented 5 years ago

Hey @FabienM, thanks for the contribution! This was briefly discussed in #40. The intended canonical import path for this module is howett.net/plist.

FabienM commented 5 years ago

HI @DHowett , my bad, i didn't see this :-)

Still, i don't get how we should deal with transitive dependencies that import your module. As they have import github.com/DHowett/go-plist/<somepackage> in some go file header, go module tries to resolve this as the github.com/DHowett/go-plist module, land on this repo and find the go.mod that claims a mismatching module name.

I had to temporary fix it with a replace in my top-level module's go.mod that freezes the previous commit:

replace github.com/DHowett/go-plist => github.com/DHowett/go-plist v0.0.0-20180729002649-fed556ad7290

Since howett.net/plist is not an importable go path, i don't see how it could be used as is as a module name, but maybe i miss something :-)

How should your module be used to avoid this unexpected module path error?

Best,

DHowett commented 5 years ago

Still, i don't get how we should deal with transitive dependencies that import your module. As they have import github.com/DHowett/go-plist/<somepackage> in some go file header, go module tries to resolve this as the github.com/DHowett/go-plist module, land on this repo and find the go.mod that claims a mismatching module name.

I had to temporary fix it with a replace in my top-level module's go.mod that freezes the previous commit:

replace github.com/DHowett/go-plist => github.com/DHowett/go-plist v0.0.0-20180729002649-fed556ad7290
replace github.com/DHowett/go-plist => howett.net/plist

(this should work)

Since howett.net/plist is not an importable go path, i don't see how it could be used as is as a module name, but maybe i miss something :-)

It should be an importable Go path!

(antares) /tmp % go get howett.net/plist
(antares) /tmp % find . -name 'bplist_parser.go'
./src/howett.net/plist/bplist_parser.go

How should your module be used to avoid this unexpected module path error?

If replace works, that'll be a good start. I do want to move more and more third-party consumers to the official, canonical import path. I'm happy to file issues on their repositories encouraging them to switch!

FabienM commented 5 years ago

Fair enough :-)

cjbassi commented 5 years ago

Running into this issue too and using the replace method worked. Genuine question, but why not just use github.com/DHowett/go-plist as the canonical import path? The current method goes against the expected behavior of go packages using the github url they're hosted at.

DHowett commented 5 years ago

@cjbassi alas, github is not the primary source for this package. I do not personally believe in promoting a software monoculture of any kind, so I don't think I should tie myself or others to GitHub[1]. I've discussed this a bit more here, if you're interested!

[1]: (personal opinion, not that of my employer, standard disclaimers apply, no warranty, etc.)