GO: unknown flag -trimpath
This is my first time with GO.
/* hello.go My first GOlang program */
package main
import "fmt"
func main() {
fmt.Printf("Hello World\n")
}
I am getting this error:
# command-line-arguments
/usr/local/go/pkg/tool/darwin_amd64/6g: unknown flag -trimpath
I can't figure out what the problem is.
source to share
Apparently it has something to do with how go was installed.
See GOlang Some common mistakes
after trying 1.3 means you need to unzip the .tar.gz file to / usr / local
http://golang.org/doc/install#tarball
You can't just install golang 1.3 from the installer, you should try the untar option for best results.
Errors found during:
brew install spiff go install github.com/tools/godep # github.com/kr/fs /usr/local/go/pkg/tool/darwin_amd64/6g: unknown flag -trimpath
So follow the section
Download the archive and extract it to / usr / local, creating a Go tree in
/usr/local/go
.
For example:
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
Select the archive file that matches your installation. For example, if you are installing Go 1.3 for 64-bit x86 on Linux, the target archive is called go1.3.linux-amd64.tar.gz.
Add
/usr/local/go/bin
to environment variablePATH
. You can do this by adding this line to your/etc/profile
(for a system-wide installation) or$HOME/.profile
.
export PATH=$PATH:/usr/local/go/bin
To uninstall and get started: see Uninstall Go
To remove an existing Go installation from your system, delete the go directory. This is usually
/usr/local/go
under Linux, Mac OS X and FreeBSD, orc:\Go
under Windows.You must also remove the Go directory
bin
from the environment variablePATH
.
On Linux and FreeBSD, you must edit/etc/profile
or$HOME/.profile
. If you installed Go with a Mac OS X package, you should delete the file/etc/paths.d/go
.
source to share