Skip to content

cmd/go: provide example documentation for trimpath arguments with spaces #37815

Closed
@siddharth178

Description

@siddharth178

What version of Go are you using (go version)?

$ go version
go version go1.14 darwin/amd64

Does this issue reproduce with the latest release?

Yes. It is also reproducible on linux amd64.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/siddharth/Library/Caches/go-build"
GOENV="/Users/siddharth/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/siddharth/myprogs/gillnet/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jw/khwlx1jx0y9b2c8fgbt0pd5h0000gn/T/go-build199978540=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

[~/myprogs/test 1]$ ls
main.go
[~/myprogs/test 1]$ cat main.go
package main

import "fmt"

func main() {
	fmt.Println("hello!")
}

[~/myprogs/test 1]$ go build -asmflags="all=-trimpath=`pwd`"

What did you expect to see?

Successful build with given path references removed.

What did you see instead?

[~/myprogs/test 1]$ go build -asmflags="all=-trimpath=`pwd`"
# runtime/internal/atomic
usage: asm [options] file.s ...
Flags:
  -D value
    	predefined symbol with optional simple value -D=identifier=value; can be set multiple times
  -I value
    	include directory; can be set multiple times
  -S	print assembly and machine code
  -V	print version and exit
  -debug
    	dump instructions as they are parsed
  -dynlink
    	support references to Go symbols defined in other shared libraries
  -e	no limit on number of errors reported
  -gensymabis
    	write symbol ABI information to output file, don't assemble
  -newobj
    	use new object file format
  -o string
    	output file; default foo.o for /a/b/c/foo.s as first argument
  -shared
    	generate code that can be linked into a shared library
  -trimpath string
    	remove prefix from recorded source file paths
# internal/cpu
usage: asm [options] file.s ...
Flags:
  -D value
    	predefined symbol with optional simple value -D=identifier=value; can be set multiple times
  -I value
    	include directory; can be set multiple times
  -S	print assembly and machine code
  -V	print version and exit
  -debug
    	dump instructions as they are parsed
  -dynlink
    	support references to Go symbols defined in other shared libraries
  -e	no limit on number of errors reported
  -gensymabis
    	write symbol ABI information to output file, don't assemble
  -newobj
    	use new object file format
  -o string
    	output file; default foo.o for /a/b/c/foo.s as first argument
  -shared
    	generate code that can be linked into a shared library
  -trimpath string
    	remove prefix from recorded source file paths
# sync/atomic
usage: asm [options] file.s ...
Flags:
  -D value
    	predefined symbol with optional simple value -D=identifier=value; can be set multiple times
  -I value
    	include directory; can be set multiple times
  -S	print assembly and machine code
  -V	print version and exit
  -debug
    	dump instructions as they are parsed
  -dynlink
    	support references to Go symbols defined in other shared libraries
  -e	no limit on number of errors reported
  -gensymabis
    	write symbol ABI information to output file, don't assemble
  -newobj
    	use new object file format
  -o string
    	output file; default foo.o for /a/b/c/foo.s as first argument
  -shared
    	generate code that can be linked into a shared library
  -trimpath string
    	remove prefix from recorded source file paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions