Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix go.mod to make module importable #41

Closed
wants to merge 1 commit into from

Conversation

FabienM
Copy link

@FabienM FabienM commented Dec 6, 2018

Currently, module is not importable:

$ go mod download
go: github.com/DHowett/[email protected]: parsing go.mod: unexpected module path "howett.net/plist"

This commit should fix this.

Regards,

Currently, module is not importable:

```
$ go mod download
go: github.com/DHowett/[email protected]: parsing go.mod: unexpected module path "howett.net/plist"
```

This commit should fix this.

Regards,
@DHowett
Copy link
Owner

DHowett commented Dec 6, 2018

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
Copy link
Author

FabienM commented Dec 7, 2018

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
Copy link
Owner

DHowett commented Dec 7, 2018

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
Copy link
Author

FabienM commented Dec 7, 2018

Fair enough :-)

@FabienM FabienM closed this Dec 7, 2018
@cjbassi
Copy link

cjbassi commented Dec 28, 2018

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
Copy link
Owner

DHowett commented Dec 28, 2018

@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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants