Re-install package with go tool

5,006 views
Skip to first unread message

Archos

unread,
Feb 12, 2012, 5:55:27 AM2/12/12
to golang-nuts
How to re-install a package?

$ ll ~/go/pkg/linux_amd64/github.com/kless/GoStart
total 8
drwxrwxr-x 2 neo neo 4096 2012-02-12 10:48 ./
drwxrwxr-x 13 neo neo 4096 2012-02-10 23:52 ../
$ go install -v ./start/
github.com/kless/GoStart/start
$ ll ~/go/pkg/linux_amd64/github.com/kless/GoStart
total 148
drwxrwxr-x 2 neo neo 4096 2012-02-12 10:48 ./
drwxrwxr-x 13 neo neo 4096 2012-02-10 23:52 ../
-rw-rw-r-- 1 neo neo 135048 2012-02-12 10:48 start.a
$ go install -v ./start/
==

It can not re-install if there is a package already created, and there
is no flag to force it

minux

unread,
Feb 12, 2012, 6:10:11 AM2/12/12
to Archos, golang-nuts
This is intentional, because the package source haven't been changed since last
'go install', so no need to re-install. If you really want to force the re-install, please
use 'go install -a'.

Archos

unread,
Feb 12, 2012, 6:21:40 AM2/12/12
to golang-nuts
I'd tested with flag "a" too but it re-install another packages too:

runtime
errors
sync/atomic
unicode
sync
io
math
unicode/utf8
bytes
syscall
time
os
strings
strconv
exp/signal
sort
path/filepath
path
reflect
io/ioutil
os/exec
fmt
exp/inotify
go/token
log
go/scanner
go/ast
go/parser
go/build
github.com/kless/GoStart/start

On Feb 12, 11:10 am, minux <minux...@gmail.com> wrote:

minux

unread,
Feb 12, 2012, 6:27:24 AM2/12/12
to Archos, golang-nuts
Yes, -a will re-install everything needed.
But, I'm still curious why you want to force re-install when no source changes have been made?
The go tool is designed to free you from handling these things, just like make(1).

If you just want to reinstall one pkg, just remove the pkg.a file from $GOPATH/pkg and 'go install'
again.

Archos

unread,
Feb 12, 2012, 6:34:17 AM2/12/12
to golang-nuts
I know that it's a case very specific so I'll use "go install -a" .
It's for a test to simulate that a package has changed so it can be re-
compiled automatically by my program.

On Feb 12, 11:27 am, minux <minux...@gmail.com> wrote:

Anthony Martin

unread,
Feb 12, 2012, 6:40:43 AM2/12/12
to Archos, golang-nuts
Archos <raul...@sent.com> once said:
> I know that it's a case very specific so I'll use "go install -a" .
> It's for a test to simulate that a package has changed so it can be re-
> compiled automatically by my program.

In your test, you could just "touch" one of the
source files to update the modification time.

$ go install -v
$ touch *.go
$ go install -v
github.com/agl/xmpp
$

Cheers,
Anthony

Archos

unread,
Feb 12, 2012, 6:44:11 AM2/12/12
to golang-nuts
It's true. Thanks!

On Feb 12, 11:40 am, Anthony Martin <al...@pbrane.org> wrote:

Archos

unread,
Feb 12, 2012, 6:55:44 AM2/12/12
to golang-nuts
And for Windows:

copy /b file.go +,,

On Feb 12, 11:40 am, Anthony Martin <al...@pbrane.org> wrote:

Sanjay Menakuru

unread,
Feb 12, 2012, 9:20:26 AM2/12/12
to golan...@googlegroups.com
Alternatively, you could run `go clean -i <pkg>` to get rid of any installed objects.

Sanjay
Reply all
Reply to author
Forward
0 new messages