dongzhong1929 2018-08-27 03:04
浏览 638
已采纳

进行构建时,“-gcflags标志的值无效” all -N -l”

I want to remote debug Golang bin file with delve. First, I need to compile the .go file:

go build -gcflags='all -N -l' main.go

but the outcome is

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.

How to solve this problem?

go version: 1.10.3 amd64/linux

  • 写回答

1条回答 默认 最新

  • dqwh1219 2018-08-27 06:29
    关注

    How to solve this problem?

    $ go build -gcflags='all -N -l' main.go
    invalid value "all -N -l" for flag -gcflags: missing =<value> in <pattern>=<value>
    usage: go build [-o output] [-i] [build flags] [packages]
    Run 'go help build' for details.
    

    Follow the instructions in the error message.

    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>>
    

    Follow the instructions in the help text precisely.

    The argument list may be preceded by a package pattern and an equal sign.

    For example, for package patterm all: all=.

    go build -gcflags='all=-N -l' main.go
    

    References:

    Command go: Compile packages and dependencies

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?