-
Notifications
You must be signed in to change notification settings - Fork 18k
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: mkdir C:\Program Files\Go: Access is denied. #44691
Comments
@jayconrod @matloob @bcmills can you please take a look? I'm not sure what the advice is for troubleshooting permissions issues |
I think a good next step here would be to determine if Go is installed properly and it's able to build programs. For example, does the The installed path changed recently in #42070 (CC @toothrot), but I don't think that should be causing this. It seems like the GOPATH directory may be misconfigured, possibly from a left-over previous installation. |
The
That probably needs to be changed. |
The go/src/cmd/go/internal/modfetch/cache.go Line 221 in 4c1a7ab
That implies that the path from that error message is in the module cache, which defaults to The user-reported
So whatever generated that error message is using a different value for |
So, what we need to know now is: what was the actual (Independently, setting |
So all you respected peeps , who are actually helping with the doubt, first of all thank you but what I want is : Can any one of you can tell me the clean precise steps I should finally do ? |
@Jassi10000 Did you install If you have a previous version of |
yes sir , I did that exactly same , that's why second time I changes the file directory , I think that was my only mistake , |
You can find instructions to uninstall a previous version at https://golang.org/doc/manage-install#uninstalling, and instructions to install a new version at https://golang.org/doc/install. See https://golang.org/help/ for more places to get help. I'll close this issue since it doesn't seem to be a bug in the Go project. |
H
is the issue solved ? because i have found a way to solve it. |
@AliPeeri no it's not |
I had this error after installing Go just now. I ran VS Code in Administrator mode and it all went away... So for me I'm pretty sure it was a Windows permissions problem. |
Had the same issue and resolved it with what @Davo36 did. |
@AdamMK : Actually I had this again recently and I found the problem to be that I had my GOPATH variable set incorrectly. I describe that here: #26814 Go down to the bottom to see what I did. I had 2 values for the GOPATH variable when viewing in the environment variables dialog box on Windows. But it did look very much like a Windows permissions problem since Administrator mode makes it go away. |
I don't think this issue is resolved. I install go with go1.17.3.windows-amd64.msi, and I still see the default repo path is "C:\Program Files\Go\src", then we will sure get the error because of the Windows protection. The repo should be in C:\Users\XXXX\ by default but not in C:\Program Files, just as maven, nodejs and many others did. Ask for admin privilege doesn't make sense at all. |
Tools environment: GOPATH=D:\code_go, GOBIN=D:\go\bin Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest (D:\go\bin\gopkgs.exe) SUCCEEDED All tools successfully installed. You are ready to Go. :) make sure your GOPATH GOROOT GOBIN GOPROXY are all correct ! |
go env -w GOPROXY=https://goproxy.io,direct |
This issue is closed. If you are seeing similar symptoms, please file a new issue and fill out the complete template. Thanks. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I tried to install all the necessary modules for Go to setup in VS-Code , as I was preparing to make a project with GoLang
What did you expect to see?
I expected to see all the Go tools properly setup , and after that smooth functioning in VS-Code
What did you see instead?
gopls: failed to install gopls(golang.org/x/tools/gopls): Error: Command failed: c:\go\bin\go.exe get -v golang.org/x/tools/gopls
go: writing stat cache: mkdir C:\Program Files\Go: Access is denied.
go: writing stat cache: mkdir C:\Program Files\Go: Access is denied.
go: downloading golang.org/x/tools/gopls v0.6.6
go: writing go.mod cache: mkdir C:\Program Files\Go: Access is denied.
go: downloading golang.org/x/tools v0.1.0
go get golang.org/x/tools/gopls: mkdir C:\Program Files\Go: Access is denied.
no output
The text was updated successfully, but these errors were encountered: