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

cmd/scriggo: allow to set the package name in the Scriggo file #906

Open
gazerro opened this issue Oct 15, 2021 · 3 comments
Open

cmd/scriggo: allow to set the package name in the Scriggo file #906

gazerro opened this issue Oct 15, 2021 · 3 comments
Assignees
Labels

Comments

@gazerro
Copy link
Member

gazerro commented Oct 15, 2021

Currently, it is not possible to set the package name with the IMPORT instruction in a Scriggo file.

For example

IMPORT github.com/3dsinteractive/uuid AS foobar

changes the package path but does not change the package name.

I propose to change the IMPORT instruction in the following way

IMPORT <package> AS <as>

As for IMPORT <package> but the path by which it can be imported is named as and the package name is the last path element of as.

IMPORT <package> WITH NAME <name>

As for IMPORT <package> but the package name is name. If AS <as> precedes WITH NAME <name>, the package path is as and the package name is name.

If the package name is not a valid Go identifier, an error occurs.

Examples

IMPORT github.com/3dsinteractive/uuid AS foo
# package has path "foo" and name "foo"
IMPORT github.com/3dsinteractive/uuid AS github.com/3dsinteractive/foo
# package has path "github.com/3dsinteractive/foo" and name "foo"
IMPORT github.com/3dsinteractive/uuid WITH NAME bar
# package has path "github.com/3dsinteractive/uuid" and name "bar"
IMPORT github.com/zoonoo/go-msgraph AS go-msgraph WITH NAME msgraph
# package has path "go-msgraph" and name "msgraph"
@gazerro
Copy link
Member Author

gazerro commented Oct 15, 2021

cc: @maisola-work @zapateo

@zapateo
Copy link
Member

zapateo commented Oct 18, 2021

I agree with this proposal.

@maisola-work
Copy link
Member

I agree too

@gazerro gazerro changed the title proposal: cmd/scriggo: allow to set the package name in the Scriggo file cmd/scriggo: allow to set the package name in the Scriggo file Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants