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

cmd/go: go mod tidy should ignore the git ignored folders #61413

Closed
hungtcs opened this issue Jul 18, 2023 · 1 comment
Closed

cmd/go: go mod tidy should ignore the git ignored folders #61413

hungtcs opened this issue Jul 18, 2023 · 1 comment
Labels

Comments

@hungtcs
Copy link

hungtcs commented Jul 18, 2023

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

$ go version
go version go1.20.2 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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/hungtcs/.cache/go-build"
GOENV="/home/hungtcs/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/hungtcs/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/hungtcs/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/hungtcs/Workspaces/@hungtcs/rhino/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build462815564=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Sometimes, there will be some attached files in the project, for my instance,
I have a compose folder in my project root, I need to map some folders from container like data files of database,
these folders are ignored by git, but go mod tidy still scans these folders.

Sometimes these folders have special permissions, permission error occurs when go mod tidy scans like this

hungtcs.rhino/compose/data/db/data: open /home/hungtcs/Workspaces/@hungtcs/rhino/compose/data/db/data: permission denied
hungtcs.rhino/compose/data/pgadmin/sessions: open /home/hungtcs/Workspaces/@hungtcs/rhino/compose/data/pgadmin/sessions: permission denied
hungtcs.rhino/compose/data/pgadmin/storage/hungtcs_outlook.com: open /home/hungtcs/Workspaces/@hungtcs/rhino/compose/data/pgadmin/storage/hungtcs_outlook.com: permission denied
pattern all: open /home/hungtcs/Workspaces/@hungtcs/rhino/compose/data/db/data: permission denied
pattern all: open /home/hungtcs/Workspaces/@hungtcs/rhino/compose/data/pgadmin/sessions: permission denied
pattern all: open /home/hungtcs/Workspaces/@hungtcs/rhino/compose/data/pgadmin/storage/hungtcs_outlook.com: permission denied

What did you expect to see?

I hope go can intelligently ignore these folders, or provide a configurable way to ignore it.
I know one way is to rename the folder name to start with . or _ but this doesn't work in all cases,
because this severely damages the aesthetics of the project folder structure.

What did you see instead?

I currently have to rename the folders to start with ./_ to avoid this problem.

@bcmills
Copy link
Member

bcmills commented Jul 18, 2023

Duplicate of #42965

@bcmills bcmills marked this as a duplicate of #42965 Jul 18, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2023
@bcmills bcmills added the GoCommand cmd/go label Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants