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: modules generates read-only files #33516

Closed
MartinKosicky opened this issue Aug 7, 2019 · 6 comments
Closed

cmd/go: modules generates read-only files #33516

MartinKosicky opened this issue Aug 7, 2019 · 6 comments

Comments

@MartinKosicky
Copy link

@MartinKosicky MartinKosicky commented Aug 7, 2019

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

$ go version go1.12.7 linux/amd64

Does this issue reproduce with the latest release?

This is the newest version stable

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

go env Output
$ go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/martin/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/martin/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build696676537=/tmp/go-build -gno-record-gcc-switches"

What did you do?

When using go modules (go build, go install whatever) all files are downloaded into GOPATH. Problem is that these files are created with read-only mode. This makes quite complications for example on jenkins pipeline, where I build a single job (some go module), pull things from git, builds, makes services, deploy, etc...
At the end of job I want to remove the workspace (or jenkins does). It has problems because the files are created in readonly mode. I cannot use some global path for GOPATH because in jenkins jobs my organization gives me access only to some sandbox (some folder), and I can't move anywhere else.

What did you expect to see?

I would expect that these files are not created in read only mode, or that I have an ability to disable this feature.

What did you see instead?

I couldn't remove the files with rm-rf, nor could the jenkins

I overcome this issue by invoking chmod a+w -R $GOPATH after invoking all go installs go builds etc... but it's complicated if the commands fail suddenly I have to make bash script traps to do this.

@ALTree

This comment has been minimized.

Copy link
Member

@ALTree ALTree commented Aug 7, 2019

Hi,
this is a dup of #27161, #27455, and #28137.

Does simply running go clean -modcache at the end of the job fixes your issue?

@ALTree ALTree changed the title Go modules make read-only files cmd/go: modules harness generates read-only files Aug 7, 2019
@ALTree ALTree changed the title cmd/go: modules harness generates read-only files cmd/go: modules generates read-only files Aug 7, 2019
@MartinKosicky

This comment has been minimized.

Copy link
Author

@MartinKosicky MartinKosicky commented Aug 7, 2019

Well... this is not something I can not over come. I wanted to report this as possible improvement that you would not create files in read only mode (not sure how this helps anyone). Of course I can do go clean -modcache as I can do chmod a+w -R $GOPATH. The thing is I don't want to do any additional commands.

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Aug 7, 2019

Please see #27161 (comment) as a reason for this.

A general improvement to this is tracked at #31481. It seems like you need this in your CI. Does #31481 suffice your usecase ?

@MartinKosicky

This comment has been minimized.

Copy link
Author

@MartinKosicky MartinKosicky commented Aug 12, 2019

Well if you care about me/or people that actually use your app then no it doesnt suffice. Nor i dont believe in some corner case why making files readonly. Non major language does it and in golang you say its the best option and that its intended. If you want this thing to be not only working but also user friendly (assembler also work) then you shoul reconsider previous intentions and wonder if they are valid or if it can be done without sacraficing UX

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Aug 12, 2019

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Aug 12, 2019

Duplicate of #31481

@bcmills bcmills marked this as a duplicate of #31481 Aug 12, 2019
@bcmills bcmills closed this Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.