Home / go install: no install location for directory Go install: no install location for directory 06/04/2021 ~/src/go-statsd-client> echo $GOPATH/Users/me/gopath~/src/go-statsd-client> echo $GOROOT/usr/local/Cellar/go/1.1.1~/src/go-statsd-client> go installgo install: no install location for directory /Users/me/src/go-statsd-client outside GOPATHNo issue what framework the task is in this always fails with the same message. Go develop functions perfectly.You watching: Go install: no install location for directoryHere is my go envGOARCH="amd64"GOBIN=""GOCHAR="6"GOEXE=""GOHOSTARCH="amd64"GOHOSTOS="darwin"GOOS="darwin"GOPATH="/Users/me/gopath"GORACE=""GOROOT="/usr/local/Cellar/go/1.1.1"GOTOOLDIR="/usr/local/Cellar/go/1.1.1/pkg/tool/darwin_amd64"CC="gcc"GOGCCFLAGS="-g -O2 -fPIC -m64 -pthreview -fno-common"CGO_ENABLED="1"This is on Mac OSX Mountain Lion and go was mounted via homebrew. macos go Share Follow edited Mar 3 "19 at 16:47 RtmY 6,15466 gold badges4848 silver badges5454 bronze badges asked Aug 9 "13 at 14:52 tgandrewstgandrews 11.4k1515 gold badges4141 silver badges5555 bronze badges 0 Add a comment | 12 Answers 12 Active Oldest Votes120When you carry out no disagreements to go install, it defaults to attempting to install the package in the present directory. The error message is informing you that it cannot do that, because the existing catalog isn"t part of your $GOPATH.You have the right to either:Define $GOPATH to your $HOME (export GOPATH=$HOME).Move your resource to within the present $GOPATH (mv ~/src/go-statsd-client /User/me/gopath).After either, going into the go-statsd-client directory and typing go install will work-related, and also so will certainly inputting go install go-statsd-client from all over in the filedevice. The developed binaries will go right into $GOPATH/bin.As an unrelated pointer, you most likely want to nameroom your package through a doprimary name, to protect against name clashing (e.g. github.com/you/go-statsd-client, if that"s wbelow you organize your source code). Share Follow answered Aug 10 "13 at 17:03 Gustavo NiemeyerGustavo Niemeyer 18.3k33 gold badges5151 silver badges4646 bronze badges 11 | Sexactly how 6 even more comments 209For any kind of OS X users and future me, you likewise have to collection GOBIN to stop this confmaking use of message on install and also go getmkdir bin export GOBIN=$GOPATH/bin Share Follow edited Sep 2 "15 at 16:01 IKavanagh 5,6841111 gold badges3737 silver badges4343 bronze badges answered Sep 2 "15 at 15:18 Benjamin WoottonBenjamin Wootton 2,10711 gold badge77 silver badges22 bronze badges 12 | Sjust how 7 more comments 30You are using go install on a magazine exterior the GOPATH folder.Set your GOBIN env variable, or move src folder inside GOPATH.GOPATH/ bin/ src/ go-statsd-client/More info: GO BUILD Source code, line 296 Share Follow answered Aug 9 "13 at 16:15 Andrea Di PersioAndrea Di Persio 2,92611 gold badge2121 silver badges2323 bronze badges 4 Add a comment | 24You have to setup both GOPATH and GOBIN. Make certain you have done the complying with (please replace ~/go via your preferred GOPATH and ultimately readjust GOBIN). This is tested on Ubuntu 16.04 LTS. export GOPATH=~/go mkdir ~/go/binexport GOBIN=$GOPATH/binThe schosen answer did not fix the difficulty for me. Share Follow edited Apr 3 "19 at 7:46 Nik 1,86422 gold badges1414 silver badges2323 bronze badges answered May 12 "17 at 7:43 ZhenhuaZhenhua 1,6291212 silver badges1010 bronze badges 1 Add a comment | 6You"ll desire to have actually 3 directories inside your chosen GOPATH directory.GOPATH /bin /src /someProgram routine.go /someLibrary library.go /pkgThen you"ll run go install from inside either someProgram (which puts an executable in bin) or someLibrary (which puts a library in pkg). Share Follow edited Mar 18 "17 at 8:52 answered Mar 18 "17 at 8:39 Earl ZeddEarl Zedd 1,0661010 silver badges1010 bronze badges 1 Add a comment | 3I had actually this trouble on Windows.My difficulty was that my %GOPATH% atmosphere variable was collection toC:Usersjohnsrcgoworkspacerather ofC:UsersjohnsrcgoworkspaceAdding the missing trailing slash at the end solved it for me.See more: My Order From Jul 29 2016 - Focus On: 100 Most Popular American 3D Films Share Follow answered Jun 13 "15 at 2:05 eckzaeckza 2,09833 gold badges2121 silver badges2727 bronze badges 1 Add a comment | 3For what it"s worth, here"s my .bash_profile, that functions well for me on a mac via Atom, after installing go with Homebrew:export GOROOT=`go env GOROOT`export GOPATH=/Users/yy/Projects/goexport GOBIN=$GOPATH/binexport PATH=$PATH:$GOBIN Share Follow answered Apr 1 "18 at 5:50 JRunJRun 3,13855 gold badges2222 silver badges3939 bronze badges Add a comment | 2In my instance (OS X) it was bereason I have actually collection GOPATH to /home/username/go (as per the book) rather of /Users/username/go Share Follow answered Feb 20 "17 at 13:11 catamphetaminecatamphetamine 3,1182424 silver badges2424 bronze badges Add a comment | 2I"m on Windows, and I gained it by giving command also go aid goroute to cmd, and review the bold message in the instruction, that is if code you wnat to install is at ..BaseDir...SomeProjectsrcasicset, the GOPATH have to not be the same location as code, it need to be just Base Project DIR: ..BaseDir...SomeProject. The GOPATH atmosphere variable lists areas to look for Go code. On Unix, the value is a colon-separated string. On Windows, the worth is a semicolon-separated string. On Plan 9, the worth is a list. If the atmosphere variable is unset, GOPATH defaults to a subbrochure named "go" in the user"s house magazine ($HOME/go on Unix, %USERPROFILE%go on Windows), unless that magazine holds a Go circulation. Run "go env GOPATH" to see the existing GOPATH. See https://golang.org/wiki/SettingGOPATH to collection a tradition GOPATH. Each magazine noted in GOPATH have to have a prescribed structure: The src brochure holds resource code. The route listed below src determines the import path or executable name. The pkg catalog holds set up package objects. As in the Go tree, each target operating device and design pair has actually its very own subdirectory of pkg (pkg/GOOS_GOARCH). If DIR is a magazine detailed in the GOPATH, a package with source in DIR/src/foo/bar deserve to be imported as "foo/bar" and has its compiled form set up to "DIR/pkg/GOOS_GOARCH/foo/bar.a". The bin brochure holds compiled regulates. Each command also is called for its source directory, yet only the final facet, not the entire course. That is, the command with resource in DIR/src/foo/quux is installed into DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" predeal with is stripped so that you can add DIR/bin to your PATH to obtain at the mounted regulates. If the GOBIN environment variable is collection, regulates are mounted to the brochure it names rather of DIR/bin. GOBIN must be an absolute course. Here"s an example catalog layout:GOPATH=/home/user/go/home/user/go/ src/ foo/ bar/ (go code in package bar) x.go quux/ (go code in package main) y.go bin/ quux (installed command) pkg/ linux_amd64/ foo/ bar.a (installed package object) ..........See more: Pci Encryption Decryption Controller Driver Toshiba Satellite C55if GOPATH has been set to Base Project DIR and also still has this problem, in home windows you have the right to attempt to collection GOBIN as Base Project DIRin or %GOPATH%in.