compilation - How to compile go program in 1.1.2 with dependencies compiled in 1.1.1? -
every time try compile program after (this morning) upgrading go 1.1.1 1.1.2 (on windows 7 64 bits), error message like:
c:\users\vonc\prog\go\src\github.com\spf13\hugo>go build -o hugo.exe main.go # github.com/spf13/hugo/hugolib hugolib\page.go:23: import c:\users\vonc\prog\go\pkg\windows_amd64/github.com/emicklei/hopwatch.a: object [windows amd64 go1.1.1 x:none] expected [windows amd64 go1.1.2 x:none]
i tried go clean -r
, error message persists?
what right clean
command use?
actual solution:
i reproduced issue with:
- calling 1.1.2
go.exe
directly (i didn't have%goroot%\bin
in path) - with
goroot
pointing previous 1.1.1 installation folder (i kept go 1.1.1 , 1.1.2 installed in separated folders).
if sticking default go setup (ie: one c:\go
installation directory, , %goroot%\bin
in path
), won't see error.
but if see error:
- make sure
%goroot%
consistentgo.exe
calling go install -a
explained below.go clean
mentioned below won't necessary.
jnml comments:
the go build system supposed figure out obsolete stuff in
$gopath/pkg
, (transitively) rebuild on demand.
original solution:
in "remove object files" section of "command go" page, missed go clean -i
option:
-i
the
-i
flag causes clean remove corresponding installed archive or binary (what 'go install' create).
and .a
file (like hopwatch.a) precisely go install generates libraries (in windows).
so full clean command, make sure go rebuild everything, be:
cd c:\users\vonc\prog\go\src\github.com\spf13\hugo go clean -r -i go install -a
that rebuild , install everything, including dependent packages.
the -a
build option, forces rebuilding of packages up-to-date.
as usual, go clean -r -n
show cleaned (-n
: preview option).
doesn't hurt sure of deleted... before deleting anything.
Comments
Post a Comment