-
Notifications
You must be signed in to change notification settings - Fork 59
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
Conflicting package names #9
Comments
We have mirrored the names for clarity, and with Go import naming this should not be a problem. import x-widgets "fyne.io/x/fyne/widgets` What would your suggestion be? |
I'd probably try to avoid the same names as it will hopefully be used together a lot. It could actually be called Then autoimport would work in editors as the editor would know what I want to import. Especially if |
It works for me, the IDE indexes all packages.
If you specify a package name then indeed it won't find elements that are not in that package. Search instead for "SomeXWidget" and it will find the correct package. In GoLand it will even import and name appropriately the secondary package. |
Also for background, we were following the golang.org/x/ naming. |
That's a good example, however they don't have the same problem as here, because I think @tehsphinx's proposal is good (indeed I was about to write an issue with the same title 😅).
Unfortunately, not many devs can get GoLand as it is not free, I think most of them (me included) are going to use VSCode. Or I am not sure, but import (
firebase "firebase.google.com/go"
) Looking at the source code, they have: package firebase // import "firebase.google.com/go" So, maybe package xwidget // import "fyne.io/x/fyne/widget" I have not tested yet, but if it works as in import (
xwidget "fyne.io/x/fyne/widget"
) Hope it is possible. What do you think? @andydotxyz |
What you are d escribing @fpabl0 is a vanity import - and we already have them. With regards to VSCode it will search all imported packages, if you import the fyne-x widget path it will search that as well. |
BTW: I'm using Goland and it uses the horrible package name |
appending "2" is what golang.org does for some of their packages, e.g. "net/http" vs "golang.org/net/http2". This is a subjective discussion, one which was covered when we originally created the namespace. It is not going to be solved in an issue, so I have added it to our agenda for Friday https://github.com/fyne-io/fyne/wiki/Agenda-for-weekly-calls. |
|
It's actually the fault of Golang Persistent Language Server" ( And yeah, HTTP v HTTP2 v HTTP3 are protocol versions sadly, not related to this. |
This was discussed at length on the call today, we see that there are two potential issues
The first issue cannot really be solved with naming - but @AlbinoGeek pointed out that doing For item 2 we went back and forth a lot, however when we realised that adding an "x" to every duplicated package would lead to import paths like: "fyne.io/x/fyne/xstorage/xrepository" which is quite ugly. |
@andydotxyz Sorry to reopen this. But I have a new idea. What if we divide the things in modules? Just like aws-sdk-go-v2 did. So under
The files inside package widgetx Then when users want widgets they only need to get them instead of the whole module:
The best thing is that now the alias would be automatic, just write import widgetx "fyne.io/x/fyne/widget" Then there is no more name conflicts, the url would be look good as before, and users won't need to download the whole repository when they only need extension widgets. |
That is an intriguing option, thanks. |
Yes, it is, but since we are defining a new module is not required?
I am not sure, I have only tested on VS Code, if you can try it in Goland, should be great :) |
I’m not sure what you mean here. Being a new module or not doesn’t affect the package name does it? How would this work for non-module based imports? It looks like the identifier would have to be different for the different ways it is imported? |
It does not affect, but the linter will complain. But if it is a module, the folder name does not have to be the same as the package name.
You mean when users use the GOPATH instead of the go modules? |
Yes. because we still support 1.12 |
Goland complains that "widgetx" is a typo by the way - otherwise it seems to work like Visual Studio |
As a user of the fyne framework who wants to use some widgets or features from
fyne-x
I will have to deal with package naming conflicts a lot. Bothfyne
andfyne-x
modules have a packagewidgets
and a packagelayout
.The text was updated successfully, but these errors were encountered: