details for "import cycle not allowed"?

1.229 visualizzazioni
Passa al primo messaggio da leggere

stephanos

da leggere,
26 ago 2013, 10:48:0926/08/13
a golan...@googlegroups.com
Hi there,

I just ran into a compiler error: init.go: import cycle not allowed
Obviously I've done something wrong.

But the message only shows half of the problem, init.go.
It would be interesting to see the other involved file(s), wouldn't it?

Cheers
Stephan

Ian Lance Taylor

da leggere,
26 ago 2013, 11:00:5326/08/13
a stephanos, golang-nuts
Yes, and you normally should. What version of Go are you using? Do
you have a simple test case?

Ian

stephanos

da leggere,
26 ago 2013, 11:32:0326/08/13
a golan...@googlegroups.com, stephanos
Well, I was just about to prepare a test case when I stumbled upon something.

I created a simple 3-file-project with package A and B which depend on another.
When I executed go build it showed the warning as described above: init.go:3:8: import cycle not allowed

But when I prepared the sample for GitHub and adding the proper package path this happended:

So perhaps this only works for full-path'ed packages?


Regards
Stephan

Ian Lance Taylor

da leggere,
26 ago 2013, 12:44:0526/08/13
a stephanos, golang-nuts
On Mon, Aug 26, 2013 at 8:32 AM, stephanos <stephan...@gmail.com> wrote:
> Well, I was just about to prepare a test case when I stumbled upon
> something.
>
> I created a simple 3-file-project with package A and B which depend on
> another.
> When I executed go build it showed the warning as described above:
> init.go:3:8: import cycle not allowed
>
> But when I prepared the sample for GitHub and adding the proper package path
> this happended:
> package github.com/stephanos/go_import_cycle/pckg_a
> imports github.com/stephanos/go_import_cycle/pckg_b
> imports github.com/stephanos/go_import_cycle/pckg_a: import cycle not
> allowed
>
> So perhaps this only works for full-path'ed packages?
>
> PS: https://github.com/stephanos/go_import_cycle /
> https://github.com/stephanos/go_import_cycle_local


Thanks for the test case.

http://golang.org/issue/6254

Ian

Rob Pike

da leggere,
26 ago 2013, 17:37:2926/08/13
a Ian Lance Taylor, stephanos, golang-nuts
Just last week I fixed the go command to print the import cycle, so if
you were using Go at tip you would have seen a description of the
cycle.

-rob

atkaaz

da leggere,
26 ago 2013, 17:42:2726/08/13
a golang-nuts



--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ian Lance Taylor

da leggere,
26 ago 2013, 19:19:1326/08/13
a Rob Pike, stephanos, golang-nuts
Bother, sorry about that.

Ian
Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi