GO:未知标志- trimpath

huangapple go评论102阅读模式
英文:

GO : unknown flag -trimpath

问题

这是我第一次使用GO。

/* hello.go  我的第一个GO语言程序 */

package main

import "fmt"

func main() {
        fmt.Printf("Hello World\n")
}

我遇到了这个错误:

# command-line-arguments

/usr/local/go/pkg/tool/darwin_amd64/6g: 未知标志 -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 am not able to understand what is the problem.

答案1

得分: 3

显然,这与go的安装方式有关。
参见GOlang一些常见错误

> 在尝试1.3后,意味着“你需要将.tar.gz文件解压到/usr/local”
>
> http://golang.org/doc/install#tarball
>
> 不能只是从安装程序安装golang 1.3,你应该尝试解压选项以获得更好的结果。
>
> 在以下过程中发现错误:

> brew install spiff
> go install github.com/tools/godep
>
> # github.com/kr/fs
> /usr/local/go/pkg/tool/darwin_amd64/6g: unknown flag -trimpath

所以请按照安装部分进行操作

> 下载存档并将其解压到/usr/local,创建一个Go树在/usr/local/go中。
> 例如:
>
> tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
>
> 根据您的安装选择适当的存档文件。例如,如果您要在Linux上安装64位x86的Go版本1.3,则要使用的存档文件名为go1.3.linux-amd64.tar.gz。
>
> 将/usr/local/go/bin添加到PATH环境变量中。您可以通过将此行添加到您的/etc/profile(用于系统范围的安装)或$HOME/.profile中来实现。
>
> export PATH=$PATH:/usr/local/go/bin

要卸载并重新开始,请参见卸载Go

> 要从系统中删除现有的Go安装,请删除go目录。在Linux、Mac OS X和FreeBSD下,通常是/usr/local/go,在Windows下是c:\Go
>
> 您还应该从PATH环境变量中删除Go的bin目录。在Linux和FreeBSD下,您应该编辑/etc/profile$HOME/.profile。如果您使用Mac OS X软件包安装了Go,则应删除/etc/paths.d/go文件。

英文:

Apparently, this is related to the way go has been installed.
See GOlang Some Common Errors

> after trying 1.3 meant “you need to unapck your .tar.gz file to /usr/local
>
> http://golang.org/doc/install#tarball
>
> One can not just install the golang 1.3 from the installer, you should try out the untar option for better 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 install section

> Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go.
> For example:
>
> tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
>
> Choose the archive file appropriate for your installation. For instance, if you are installing Go version 1.3 for 64-bit x86 on Linux, the archive you want is called go1.3.linux-amd64.tar.gz.
>
> Add /usr/local/go/bin to the PATH environment variable. 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 start over: 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 or c:\Go under Windows.
>
> You should also remove the Go bin directory from your PATH environment variable.
Under Linux and FreeBSD you should edit /etc/profile or $HOME/.profile. If you installed Go with the Mac OS X package then you should remove the /etc/paths.d/go file.

huangapple
  • 本文由 发表于 2014年8月2日 21:26:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/25095518.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定