1

When loading VSCode my Go extension is generating an error as follows:

Error loading workspace: 1 modules have errors: example.com/hello:pattern example.com/hello/...: open C:\Users<user>\AppData\Local\Temp<file_name>.tmp: Access is denied.

I tried removing the Go extension and reinstalling it, thinking it would recreate the needed temp file, but no luck. I don't know what else to check, and I did not find a suitably similar problem when searching for it. Any help is appreciated.

  • which OS are you using , if linux try giving permissions to the folder chmod 777. – LumbusterTick Oct 08 '22 at 22:44
  • I guess its windows because of C:\Users...\AppData\Local\Temp – Siraf Oct 09 '22 at 14:49
  • @LumbusterTick I am using Windows. I thought the problem went away, but it reappears when I save new files. The permissions on this file are set to read only, so I could remove the read only flag as a workaround, but I don't know what the impact of that will be. When the temp file was created, I have to assume it was set to read only for a reason, so it doesn't feel right to just change the file permissions. – Chris Phillips Oct 09 '22 at 16:02

1 Answers1

0

I think I figured this out. I decided to try to open the file and determine its contents. When I did, I discovered this is not actually a file, but is a directory with several sub-directories. I checked the permissions and the folder is marked read only, but my user ID and administrator both have full access permissions. That gave me the idea to try running VS Code as administrator, and the error seems to have cleared. I don't know why the permissions from my user ID are not passing through to VS Code requiring me to run as administrator. I also don't know that running VS Code as administrator is a good practice. However, doing so cleared this particular error.