On Wed, Jun 26, 2019 at 1:39 PM Gert <gert.cuyk...@gmail.com> wrote:
>
> Hmm trying to work on the src code of `go doc` but every time I try to 
> compile a ./doc binary it uses other src code, it doesn't look in the current 
> directory am in, I have to force it `go build main.go` what going on here?
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> go build
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> ls
> dirs.go         doc             doc_test.go     main.go         pkg.go        
>   testdata
>
> I can see a doc binary getting created but its not build form the main.go in 
> current directory, I deliberately put a syntax error in main?
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> go build main.go
> # command-line-arguments
> ./main.go:78:2: syntax error: unexpected --, expecting }
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> go env
> GOARCH="amd64"
> GOBIN="/Users/gert/bin"
> GOCACHE="/Users/gert/Library/Caches/go-build"
> GOEXE=""
> GOFLAGS=""
> GOHOSTARCH="amd64"
> GOHOSTOS="darwin"
> GOOS="darwin"
> GOPATH="/Users/gert/go"
> GOPROXY=""
> GORACE=""
> GOROOT="/usr/local/go"
> GOTMPDIR=""
> GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
> GCCGO="gccgo"
> CC="clang"
> CXX="clang++"
> CGO_ENABLED="1"
> GOMOD="/Users/gert/Desktop/go/src/cmd/go.mod"
> 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/dv/8tlwvjr91zjdyq4rk14lkkfm0000gn/T/go-build645754300=/tmp/go-build
>  -gno-record-gcc-switches -fno-common"


This may be related to https://golang.org/issue/32724.  Is your
cmd/doc directory underneath the directory displayed by `go env
GOROOT`?

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcU6zGmfS3n9_vdH2fFF%3DYp4zWgZzmF_zwjCQx-MiKdnLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to