cmd/scriggo: allow to set the package name in the Scriggo file
gazerro opened this issue · 3 comments
gazerro commented
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 namedas
and the package name is the last path element ofas
.
IMPORT <package> WITH NAME <name>
As for
IMPORT <package>
but the package name isname
. IfAS <as>
precedesWITH NAME <name>
, the package path isas
and the package name isname
.
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 commented
zapateo commented
I agree with this proposal.
maisola-work commented
I agree too