search by tags

for the user

adventures into the land of the command line

popping my go cherry

the $GOPATH... all of your go development must be under this one place. otherwise it'll not work.

on a mac, it will be by default: /Users/mygroovyuser/go/

$GOPATH/src/mygroovyproject
$GOPATH/src/mygroovyproject/vendor
$GOPATH/src/mygroovyproject/vendor/k8s.io/client-go
$GOPATH/src/mygroovyproject/main.go
$GOPATH/src/myothergroovyproject/
.
.

let's install glide.

★ go env

GOARCH="amd64"
GOBIN=""  <==========8 HERE
GOCACHE="/Users/mygroovyuser/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mygroovyuser/go"  <==========8 HERE
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"  <==========8 HERE
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/h9/z1nr4k9d74z045zntpkffryc0000gn/T/go-build152146662=/tmp/go-build -gno-record-gcc-switches -fno-common"

however if it is not set you will see:

★ curl https://glide.sh/get | sh
.
.
glide needs environment variable $GOPATH. Set it before continue.
Fail to install glide

★ echo $GOPATH

★ export GOPATH="/Users/mygroovyuser/go"

glide tries to install itself in your $GOPATH/bin rather than $GOROOT/bin which is where the go binary is. if there is no bin directory, you will see:

★ curl https://glide.sh/get | sh
.
.
/Users/mygroovyuser/go/bin ($GOPATH/bin) folder not found. Please create it before continue.
Fail to install glide

as i mentioned, the go binary is in $GOROOT, but it'll look in $GOBIN and won't find it:

★ mkdir -p /Users/mygroovyuser/go/bin
★ curl https://glide.sh/get | sh
.
.
ARCH=amd64
OS=darwin
Using curl as download tool
Getting https://glide.sh/version
TAG=v0.13.2
GLIDE_DIST=glide-v0.13.2-darwin-amd64.tar.gz
Downloading https://github.com/Masterminds/glide/releases/download/v0.13.2/glide-v0.13.2-darwin-amd64.tar.gz
glide not found. Did you add $GOBIN to your $PATH?
Fail to install glide

so you gotta set it also:

★ export GOBIN="/Users/mygroovyuser/go/bin/"
★ export PATH="$GOBIN:$PATH"

★ curl https://glide.sh/get | sh
.
.
glide version v0.13.2 installed successfully

now let's use glide to install a package dependency for our project

★ mkdir /Users/mygroovyuser/go/src
★ cd /Users/mygroovyuser/go/src/mygroovyproject
★ vim glide.yaml

package: k8s.io/client-go/
import:
- package: k8s.io/client-go
  version: v10.0.0

★ glide up -v
[WARN]  The name listed in the config file (k8s.io/client-go/) does not match the current location (arr)
[INFO]  Downloading dependencies. Please wait...
[INFO]  --> Fetching updates for k8s.io/client-go
[INFO]  --> Setting version for k8s.io/client-go to v10.0.0.
[INFO]  Resolving imports
[INFO]  --> Fetching k8s.io/api
[INFO]  --> Fetching github.com/gogo/protobuf
[INFO]  --> Fetching k8s.io/apimachinery
[INFO]  Found Godeps.json file in /Users/sebastianconnan/.glide/cache/src/https-k8s.io-apimachinery
[INFO]  --> Parsing Godeps metadata...
[INFO]  --> Setting version for github.com/gogo/protobuf to 342cbe0a04158f6dcb03ca0079991a51a4248c02.
[INFO]  --> Fetching github.com/google/gofuzz
[INFO]  --> Setting version for github.com/google/gofuzz to 44d81051d367757e1c7c6a5a86423ece9afcf63c.
[INFO]  Found Godeps.json file in /Users/sebastianconnan/.glide/cache/src/https-k8s.io-client-go
[INFO]  --> Parsing Godeps metadata...
[INFO]  --> Fetching github.com/imdario/mergo
[INFO]  --> Setting version for github.com/imdario/mergo to 9316a62528ac99aaecb4e47eadd6dc8aa6533d58.
[INFO]  --> Fetching github.com/spf13/pflag
[INFO]  --> Setting version for github.com/spf13/pflag to 583c0c0531f06d5278b7d917446061adc344b5cd.
[INFO]  --> Fetching golang.org/x/crypto
[INFO]  --> Setting version for golang.org/x/crypto to de0752318171da717af4ce24d0a2e8626afaeb11.
[INFO]  --> Setting version for k8s.io/apimachinery to 2b1284ed4c93a43499e781493253e2ac5959c4fd.
[INFO]  --> Fetching k8s.io/klog
[INFO]  --> Setting version for k8s.io/klog to 8139d8cb77af419532b33dfa7dd09fbc5f1d344f.
[INFO]  --> Setting version for k8s.io/api to 89a74a8d264df0e993299876a8cde88379b940ee.
[INFO]  --> Fetching gopkg.in/inf.v0
[INFO]  --> Setting version for gopkg.in/inf.v0 to 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4.
[INFO]  --> Fetching github.com/golang/protobuf
[INFO]  --> Setting version for github.com/golang/protobuf to b4deda0973fb4c70b50d226b1af49f3da59f5265.
[INFO]  --> Fetching github.com/googleapis/gnostic
[INFO]  --> Setting version for github.com/googleapis/gnostic to 0c5108395e2debce0d731cf0287ddf7242066aba.
[INFO]  --> Fetching github.com/gregjones/httpcache
[INFO]  --> Setting version for github.com/gregjones/httpcache to 787624de3eb7bd915c329cba748687a3b22666a6.
[INFO]  --> Fetching github.com/peterbourgon/diskv
[INFO]  --> Setting version for github.com/peterbourgon/diskv to 5f041e8faa004a95c88a202771f4cc3e991971e6.
[INFO]  --> Fetching golang.org/x/net
[INFO]  --> Setting version for golang.org/x/net to 0ed95abb35c445290478a5348a7b38bb154135fd.
[INFO]  --> Fetching golang.org/x/oauth2
[INFO]  --> Setting version for golang.org/x/oauth2 to a6bd8cefa1811bd24b86f8902872e4e8225f74c4.
[INFO]  --> Fetching golang.org/x/time
[INFO]  --> Setting version for golang.org/x/time to f51c12702a4d776e4c1fa9b0fabab841babae631.
[INFO]  --> Fetching golang.org/x/sys
[INFO]  --> Setting version for golang.org/x/sys to 95c6576299259db960f6c5b9b69ea52422860fce.
[INFO]  --> Fetching gopkg.in/yaml.v2
[INFO]  --> Setting version for gopkg.in/yaml.v2 to 5420a8b6744d3b0345ab293f6fcba19c978f1183.
[INFO]  --> Fetching github.com/google/btree
[INFO]  --> Setting version for github.com/google/btree to 7d79101e329e5a3adf994758c578dab82b90c017.
[INFO]  --> Fetching google.golang.org/appengine
[INFO]  --> Fetching github.com/json-iterator/go
[INFO]  --> Setting version for github.com/json-iterator/go to ab8a2e0c74be9d3be70b3184d9acc634935ded82.
[INFO]  --> Fetching github.com/modern-go/reflect2
[INFO]  --> Setting version for github.com/modern-go/reflect2 to 94122c33edd36123c84d5368cfb2b69df93a0ec8.
[INFO]  --> Fetching sigs.k8s.io/yaml
[INFO]  --> Setting version for sigs.k8s.io/yaml to fd68e9863619f6ec2fdd8625fe1f02e7c877e480.
[INFO]  --> Fetching golang.org/x/text
[INFO]  --> Setting version for golang.org/x/text to b19bf474d317b857955b12035d2c5acb57ce8b01.
[INFO]  --> Fetching github.com/modern-go/concurrent
[INFO]  --> Setting version for github.com/modern-go/concurrent to bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94.
[INFO]  Downloading dependencies. Please wait...
[INFO]  Setting references for remaining imports
[INFO]  Exporting resolved dependencies...
[INFO]  --> Exporting github.com/spf13/pflag
[INFO]  --> Exporting github.com/peterbourgon/diskv
[INFO]  --> Exporting github.com/gogo/protobuf
[INFO]  --> Exporting github.com/google/btree
[INFO]  --> Exporting github.com/google/gofuzz
[INFO]  --> Exporting github.com/golang/protobuf
[INFO]  --> Exporting github.com/imdario/mergo
[INFO]  --> Exporting github.com/googleapis/gnostic
[INFO]  --> Exporting github.com/gregjones/httpcache
[INFO]  --> Exporting k8s.io/client-go
[INFO]  --> Exporting golang.org/x/time
[INFO]  --> Exporting golang.org/x/crypto
[INFO]  --> Exporting golang.org/x/oauth2
[INFO]  --> Exporting golang.org/x/sys
[INFO]  --> Exporting gopkg.in/yaml.v2
[INFO]  --> Exporting golang.org/x/net
[INFO]  --> Exporting gopkg.in/inf.v0
[INFO]  --> Exporting k8s.io/api
[INFO]  --> Exporting k8s.io/klog
[INFO]  --> Exporting k8s.io/apimachinery
[INFO]  --> Exporting github.com/json-iterator/go
[INFO]  --> Exporting github.com/modern-go/reflect2
[INFO]  --> Exporting google.golang.org/appengine
[INFO]  --> Exporting github.com/modern-go/concurrent
[INFO]  --> Exporting sigs.k8s.io/yaml
[INFO]  --> Exporting golang.org/x/text
[INFO]  Replacing existing vendor dependencies
[INFO]  Project relies on 26 dependencies.
[INFO]  Removing nested vendor and Godeps\_workspace directories...