Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/goimports: does not work if there are spaces in the path #40482

Closed
xorcare opened this issue Jul 29, 2020 · 3 comments
Closed

x/tools/cmd/goimports: does not work if there are spaces in the path #40482

xorcare opened this issue Jul 29, 2020 · 3 comments
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@xorcare
Copy link

xorcare commented Jul 29, 2020

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

$ go version
go version go1.14.6 darwin/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
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/xor/Library/Caches/go-build"
GOENV="/Users/xor/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/xor/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/Users/xor/sdk/go1.14.6"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/xor/sdk/go1.14.6/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/xor/Documents/Source Code/golden/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/yh/x8t18v653t752p5nk400qt580000gn/T/go-build156301565=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I running command in /Users/xor/Documents/Source Code/golden:

test -z $(go list -f {{.Dir}} ./... | while read d; do goimports -e -l -local github.com/xorcare/golden -w "$d/*.go"; done)

goimports version: golang.org/x/tools v0.0.0-20200729173947-1c30660f9f89

What did you expect to see?

I want to see formatted imports...

What did you see instead?

test -z $(go list -f {{.Dir}} ./... | while read d; do goimports -e -l -local github.com/xorcare/golden -w "$d/*.go"; done)
stat /Users/xor/Documents/Source Code/golden/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/internal/integration/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/v2/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/v2/abstract/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/v2/goldenjson/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/v2/internal/cast/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/v2/internal/extension/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/v2/internal/goldenbuilder/*.go: no such file or directory
stat /Users/xor/Documents/Source Code/golden/v2/internal/testing/*.go: no such file or directory
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jul 29, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jul 29, 2020
@heschi
Copy link
Contributor

heschi commented Jul 29, 2020

You are literally passing "directory/*.go" to goimports, which doesn't work. I don't know how to do what you're trying to do offhand, but this is not a bug in goimports.

@heschi heschi closed this as completed Jul 29, 2020
@heschi
Copy link
Contributor

heschi commented Jul 29, 2020

Oh, probably just change "$d/*.go" to "$d"/*.go.

@xorcare
Copy link
Author

xorcare commented Jul 30, 2020

Oh, probably just change "$d/*.go" to "$d"/*.go.

It worked, thanks! 😄

@golang golang locked and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants