Skip to content

cmd/dist: accept imports with leading space #47544

Description

@XiaodongLoong
$ ./make.bash 
Building Go cmd/dist using /usr/lib/go-1.11. (go1.11.6 linux/amd64)
Building Go toolchain1 using /usr/lib/go-1.11.
../../../../src/cmd/compile/internal/mips64/ggen.go:9: cannot find package "cmd/compile/internal/objw" in any of:
	/usr/lib/go-1.11/src/cmd/compile/internal/objw (from $GOROOT)
	/home/liuxiaodong/go-orig/pkg/bootstrap/src/cmd/compile/internal/objw (from $GOPATH)
go tool dist: FAILED: /usr/lib/go-1.11/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap bootstrap/cmd/...: exit status 1

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

$ go version
go version go1.11.6 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/liuxiaodong/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/liuxiaodong/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go-1.11"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.11/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/liuxiaodong/go-orig/src/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build598535792=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I import packages and indent with spaces, just like this:

diff --git a/src/cmd/compile/internal/mips64/ggen.go b/src/cmd/compile/internal/mips64/ggen.go
index 37bb871958..881fe8776d 100644
--- a/src/cmd/compile/internal/mips64/ggen.go
+++ b/src/cmd/compile/internal/mips64/ggen.go
@@ -6,7 +6,7 @@ package mips64
 
 import (
        "cmd/compile/internal/ir"
-       "cmd/compile/internal/objw"    // indent with tab
+        "cmd/compile/internal/objw"   // indent with spaces
        "cmd/compile/internal/types"
        "cmd/internal/obj"
        "cmd/internal/obj/mips"

What did you expect to see?

When I import packages and indent with spaces, I can execute make.bash successfully.
Just keep consistent with the behavior of the go compiler.
Thanks!

What did you see instead?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions