douyi9447 2017-04-03 12:18
浏览 249

如何在不使用go get的情况下安装Go应用?

I'm trying to install a specific version of CockroachDB on my ubuntu machine. I followed the guide on the site and after downloading ~200MB, the latest version is installed :

$ go get -d
$ cd $GOPATH/src/
$ git checkout beta-20170330
$ make install

One issue is that /src/ is 300MB while if I download last version from the GitHub page it is only 30MB. Why?

I used git checkout v0.1-alpha to switch to the version I want :

warning: unable to rmdir vendor: Directory not empty
Previous HEAD position was f0f5783... Merge pull request #14448 from BramGruneir/vendorsnappy
HEAD is now at 26088f8... Merge pull request #3475 from mrtracy/mtracy/code_review_feedback

But it fails after running make install :                      99fea4bc9517 [checkout f42b554bf7f0]                             913427a1d5e8 [checkout 3b4c041f52c2]                       834d3303c9e8 [checkout c40aaae2fc50]                  323984796a7b [checkout 6a18bfcdd516]                   0dd42399d1f0 [checkout bf15ead80bdc]                    c0cd3c9ce92f [checkout 5c6d0932e0ad]                        7c99dfd2164a [get checkout 443154b1852a]                             38a914973544 [checkout 0eb46eb1457b]                      a65d4d2de4d5 [get checkout 71acacd42f85]                           6311e9fc9d34 [get checkout 5e0283effa73]              30f82fa23fd8 [checkout d5cac425555c]                     9dee4ca50b83 [get checkout d512f204a577]                           c0656edd0d9e [checkout 8658879224bd]                             cb00e5669539 [get checkout 32a87160691b]                            316fb6d3f031 [checkout cc6329d4279e]                 f0c5cfc1817d [get checkout 507e48671a07]               76626ae9c91c [get OK]                     a0ff2567cfb7 [get OK]                6f3f3919c878 [checkout f30ab90cccbd]                        23699b7e2cbf [get checkout 12fd1ab9811e]                          0de1eaf82fa3 [get checkout 58a7a198f2ec]                               cfb55aafdaf3 [get checkout e6ac2fc51e89]                                 7cafcd837844 [get checkout bb797dc4fb83]                                  2704adc878c2 [checkout 11fc39a580a0]                      14207d285c6c [checkout d96d1bd051f2]                               3447d9b0cb5a [get checkout 47b66d6a523f]                      f8cd06f93c6c [checkout 4dd27fe9ac79]                  febf2d34b54a [checkout 333c0610de34]                          11e2eec79ec4 [get checkout 591428223a6a]                            88609521dc4b [checkout 4d47685ab2fd]                     1f30fe9094a5 [checkout 7839c01b09d2]                            39b969c32281 [checkout cb3c3ec56de9]                    5f33e7b78783 [get checkout d18b67ae0afd]                    a30362618471 [get checkout 4656b1bc6cbc]          1dba4b3954bc [get checkout 10ef21a441db]                             7aeaa2cce6ae [checkout ee6224d01f6a]                             d16db1e50e33 [checkout 08b1a584251b]                         13c29c7515e6 [get checkout 0519fcc9b45b]                        bcacb06fecae [get OK]                                88915ccf7aeb [checkout 7b85b097bf75]                                   ffcf1bedda3b [checkout 21af302bb527]                                  f4b4367115ec [checkout 00e205363f74]                                 620ecdb8d794 [checkout 1cdaff4a02c5]                                   9f9df34309c0 [OK]
cmd                [built]
cmd       [error exit status 2]
protoc-gen-gogoroach/main.go:12: undefined: vanity.NotInPackageGoogleProtobuf
go install -tags ''  -ldflags '-X "" -X " 11:46:56" -X ""'
cli/sql_util.go:148: table.Append(row) used as value
Makefile:71: recipe for target 'install' failed
make: *** [install] Error 2

I'd really appreciate if I could install the specific version I downloaded from GitHub because it's smaller in size and it has a cleaner structure. But it's missing some files such as .go-version .bootstrap and fatal: Not a git repository (or any of the parent directories): .git

Does go get insert these files itself? How do I initialize them?

Shouldn't there be a better way to do this, without having to download an extra 100MB everytime I run make install?

  • 写回答

2条回答 默认 最新

  • duanbaque4230 2017-04-03 13:53

    Downloading cockroachdb using go get I get a $GOPATH/src/ with a size of 664MB.

    I then tried to clone the github repo for cockroachdb it has a size of 304MB most of which is because of the .git hidden folder which is 263MB.

    Downloading a zipfile from the github ui and unpacking it I end up with a 42MB folder.

    The pure git cloned repo and the zipfile version however lacks the vendor folder which you can read about here. It accounts for another 302MB. The folder is populated with the dependencies of cockroachdb when go get is used to download the repo (I'm guessing that it follows the link to the vendor repo for cockroach that you can see on the github page).

    Since I've done this from the master branch my sizes are a bit different from the v0.1-alpha version. But I'm guessing that it has a similar cause for the size difference.

    To get it to "work" using the zipfile you could try to extract the zipfile to $GOPATH/src/ Then do a git init in that folder. And then follow the instructions in the README for in that tag which indicate that you should run make build. However, I believe you will still need to get some of cockroachdb's dependencies, so it is probably a lot simpler to just follow the official instructions.

    I haven't tried it, but are you certain that make install causes new downloads each time you run it?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 wincc已组态的变量过多
  • ¥60 如图:直线与椭圆X轴平行,求直线与椭圆任意一点的相切坐标计算公式
  • ¥50 如何用python使用opencv里的cv::cudacodec::VideoWriter函数对视频进行GPU硬编码
  • ¥100 c#solidworks 二次开发 工程图自动标边线法兰 等折弯尺寸怎么标
  • ¥15 halcon DrawRegion 提示错误
  • ¥15 FastAPI Uvicorn启动显示404
  • ¥15 centos7.9脚本,怎么排除特定的访问记录
  • ¥15 关于#Django#的问题:我的静态文件呢?
  • ¥15 关于CPLEX的问题,请专家解答
  • ¥15 cocos的点击事件 怎么穿透到 原生fragment上。