What to do about go fmt 1.4 ?

roger peppe roger.peppe at canonical.com
Tue Mar 10 14:13:32 UTC 2015


On 10 March 2015 at 12:52, John Meinel <john at arbash-meinel.com> wrote:
> So there are 2 changes that I encountered with upgrading go to 1.4.2:
>
> 1) They changed how they sort import paths. Currently all our imports are:
>
>  "github.com/juju/juju/bar"
>  coretesting "github.com/juju/juju/testing"
> (sorted by the import string)
>
> It wants to sort them as:
>
>  coretesting "github.com/juju/juju/testing"
>  "github.com/juju/juju/bar"
>
> (sorted by the local name)

Are you sure about this? I believe that play.golang.org
is running go 1.4 and this code is canonically formatted there,
despite unordered local names: http://play.golang.org/p/5R8dyHJG5e

> 2) It no longer works if you have a symlink in your PWD
> Because of the need for exact paths, I have a link from $HOME/jc =>
> $HOME/dev/go/src/github.com/juju/juju
> However, if I do "go fmt" it now complains that:
> stat ../../../dev/go/src/github.com/juju/juju/worker/uniter/deployer.go: no
> such file or directory
>
> (it seems to be using pwd -P and then using relative paths to that)
>
> Anyone know why it would need to do that?
>
> I can work around it with "cd jc; cd `pwd -P`" or some other form so I don't
> have to type the long form each time.

Can you show a step-by-step way to reproduce this please?
If you cd into jc, surely you are now in $HOME/dev/go/src/github.com/juju/juju,
and I don't see how that's a problem. (but I've not seen the pwd -P flag
before and don't understand how that works either - how can the pwd
command know what symlinks were used to get to the current working
directory?)

  cheers,
    rog.



More information about the Juju-dev mailing list