Mac OS here. I have Go version go1.14.2 darwin/amd64 installed locally under ~/go
and in my ~/.bash_profile
I have:
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:/Users/myuser/workspace/myproject/repos
export PATH="$GOPATH/bin:$PATH"
export GOPATH=/Users/myuser/workspace/myproject/repos
export PATH=$PATH:/Users/myuser/workspace/myproject/repos/bin
I am trying to get go migrate working. When I run:
go get -tags 'postgres' -u github.com/golang-migrate/migrate/v4/cmd/migrate
I get:
$ go migrate
go migrate: unknown command
So then I tried downloading the binary directly off of GitHub and have copied it to /Users/myuser/workspace/myproject/repos/bin/
:
$ ls -al ~/myuser/myproject/repos/bin/
total 391744
drwxr-xr-x 22 myuser staff 704 Sep 22 12:41 .
drwxr-xr-x 18 myuser staff 576 Aug 20 05:41 ..
-rwxr-xr-x 1 myuser staff 18485484 Jun 15 12:38 dlv
-rwxr-xr-x 1 myuser staff 6790688 Jun 15 12:38 fillstruct
-rwxr-xr-x 1 myuser staff 4588168 Jun 15 12:37 go-outline
-rwxr-xr-x 1 myuser staff 4385080 Jun 15 12:37 go-symbols
-rwxr-xr-x 1 myuser staff 13219700 Jun 15 12:37 gocode
-rwxr-xr-x 1 myuser staff 12768972 Jun 15 12:38 gocode-gomod
-rwxr-xr-x 1 myuser staff 9168808 Jun 15 12:38 godef
-rwxr-xr-x 1 myuser staff 8031416 Jun 15 12:38 godoctor
-rwxr-xr-x 1 myuser staff 5851000 Jun 15 12:38 goimports
-rwxr-xr-x 1 myuser staff 6301816 Jun 15 12:38 golint
-rwxr-xr-x 1 myuser staff 4678536 Jun 15 12:37 gomodifytags
-rwxr-xr-x 1 myuser staff 5448568 Jun 15 12:37 gopkgs
-rwxr-xr-x 1 myuser staff 7438724 Jun 15 12:38 goplay
-rwxr-xr-x 1 myuser staff 6291392 Jun 15 12:37 gorename
-rwxr-xr-x 1 myuser staff 7990696 Jun 15 12:38 goreturns
-rwxr-xr-x 1 myuser staff 13191844 Jun 15 12:37 gotests
-rwxr-xr-x 1 myuser staff 9443888 Jun 15 12:37 guru
-rwxr-xr-x 1 myuser staff 6060712 Jun 15 12:37 impl
-rwxr-xr-x@ 1 myuser staff 41461192 Aug 3 21:34 migrate.darwin-amd64
-rwxr-xr-x 1 myuser staff 7896368 Jun 25 05:27 mockgen
But still, when I run go migrate
I get errors:
$ go migrate
go migrate: unknown command
Given where I have Go downloaded and all my path settings, which I really don't want to change, how can I install go migrate
successfully and make it work from the command line?
When I run:
$ which migrate
$
So it is not installed.
它实际上称为migrate
,您可以通过运行which migrate
或command -v migrate
来检查其位置,或者从 bin 文件夹中调用二进制文件migrate.darwin-amd64
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.