我想用delve远程调试Golang文件。首先,我需要编译.go文件:
go build -gcflags='all -N -l' main.go
但结果是
invalid value "all -N -l" for flag -gcflags: missing =<value> in <pattern>=<value> usage: build [-o output] [-i] [build flags] [packages] Run 'go help build' for details.
如何解决这个问题?
go版本: 1.10.3 amd64 64/linux
发布于 2018-08-27 06:29:54
如何解决这个问题? $ go build -gc频标志=‘all -N -l’main.go标志-gcflags的无效值"all -N -l“:缺失= in = usage: go build -o输出生成标志运行'go help build‘以获取详细信息。
按照错误消息中的说明操作。
Run 'go help build' for details.
$ go help build
<<SNIP>>
The -asmflags, -gccgoflags, -gcflags, and -ldflags flags accept a
space-separated list of arguments to pass to an underlying tool
during the build. To embed spaces in an element in the list, surround
it with either single or double quotes. The argument list may be
preceded by a package pattern and an equal sign, which restricts
the use of that argument list to the building of packages matching
that pattern (see 'go help packages' for a description of package
patterns).
<<SNIP>>
准确地遵循帮助文本中的说明。
参数列表的前面可以是包模式和等号。
例如,对于包patterm all
:all=
。
go build -gcflags='all=-N -l' main.go
参考文献:
https://stackoverflow.com/questions/52032045
复制相似问题