# os: IsDir reports false for OneDrive hosted volumes. #22434

Closed
opened this issue Oct 25, 2017 · 22 comments
Closed

# os: IsDir reports false for OneDrive hosted volumes.#22434

opened this issue Oct 25, 2017 · 22 comments
Labels

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

go version go1.9.1 windows/amd64

YES

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

• amd64
• Windows 10 Pro

### What did you do?

My code :
https://play.golang.org/p/1PkuUDceTO

I have searched below errors on Google, nothing helpful at all. What is " . " package? I written as package main instead. Where the " . " comes from?

### What did you expect to see?

Compiled or run with no errors.

### What did you see instead?

package main: cannot find package "." in: D:\OneDrive\Projects\Project-Go\sendmail

### ALTree commented Oct 25, 2017 • edited

 What command did you run? And where did you run it? And where is the code you posted located (filename and path)?
added the label Oct 25, 2017

### ankanch commented Oct 25, 2017

 I tried both ‘go run xxxx.go’ and ‘go build xxxx.go’ , however both failed with errors like that. Now, not only this file,all my other files raise error like this one. I guess there is something wrong with my go program? On Wed, Oct 25, 2017 at 11:54 PM Alberto Donizetti ***@***.***> wrote: What command did you run? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#22434 (comment)>, or mute the thread . -- from Kanch's Gmail

### ALTree commented Oct 25, 2017

 I guess there is something wrong with my go program? There must be something wrong with your Go toolchain and/or your environment. I suggest you remove everything and reinstall Go, that may fix your issue. If you need help, please see the Questions wiki page; it has a list of good places for asking questions (we only use the github issue tracker for tracking confirmed bugs, and I think the issue here is in your environment). I'm closing this, but we can always re-open later if it turns out this was a Go bug.
closed this Oct 25, 2017

### heschik commented Oct 25, 2017

 I hope that's not your password, but if it is, you should change it quick :(
mentioned this issue Oct 25, 2017

### ankanch commented Oct 25, 2017

 Hi, I tried to reinstall Go, bu the error still there. Even if it's just a simple hello world program. package main import ("fmt" ) func main() { fmt.Printf("Hello, world.\n") } 

### alexbrainman commented Oct 26, 2017

 Even if it's just a simple hello world program. According to your picture, you build your program with "Visual Studio Code". But this issue list does not for "Visual Studio Code" support. You have to show the command that you run ("go build" or whatever) to get that error message. Did you read https://golang.org/doc/code.html ? Did you follow what is suggested there before trying to use "Visual Studio Code" ? Alex

### ankanch commented Oct 26, 2017

 Here's my result: The error message is the same, that "." package cannot be found.

### alexbrainman commented Oct 26, 2017

 @ankanch I tried reproducing your error, and I cannot. Do you have test.go file in d:\onedrive\projects\project-go\practice ? What is the contents of test.go file? Alex

### ankanch commented Oct 26, 2017

 @alexbrainman Here's my practice  folder and contents of test.go. BTW,I have resolved this problem by delete practice  folder and recreate it as well as test.go. That's wired. Is the "." package stands for current directory? Thanks anyway.

### davecheney commented Oct 26, 2017

 You cannot write this statement. import “.” As it would create an recursive import loop with the current package. … On 26 Oct 2017, at 19:51, hcnak ***@***.***> wrote: @alexbrainman Here's my practice folder and contents oftest.go. BTW,I have resolved this problem by delete practice folder and recreate it as well as test.go. That's wired. Is the "." package stands for current directory? Thanks anyway. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

### ankanch commented Oct 26, 2017

 Okay, thank you. Then that would be very wired that I have NOT import package ".", but it give my the error "package . not found" . On Thu, Oct 26, 2017 at 5:05 PM, Dave Cheney wrote: … You cannot write this statement. import “.” As it would create an recursive import loop with the current package. > On 26 Oct 2017, at 19:51, hcnak ***@***.***> wrote: > > > @alexbrainman Here's my practice folder and contents oftest.go. > > BTW,I have resolved this problem by delete practice folder and recreate it as well as test.go. > That's wired. > > Is the "." package stands for current directory? > > Thanks anyway. > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or mute the thread. > — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#22434 (comment)>, or mute the thread . -- Best regards, *Long Zhang (Kanch) *＠ Chengdu University of Information Technology 2015 Computer Science Major Mail:kanchisme@gmail.com No.24 Block 1, Xuefu Road, Chengdu, Sichuan, China

### reza7rm commented Nov 16, 2017

 I get the same error on ubuntu 16.04 using liteide and go 1.9.1

### ankanch commented Nov 16, 2017

 it's a very wired problem ,I solved it by recreating the directory and files. … On Thu, Nov 16, 2017 at 6:44 PM, reza7rm ***@***.***> wrote: I get the same error on ubuntu 16.04 using liteide and go 1.9.1 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#22434 (comment)>, or mute the thread . -- Best regards, *Long Zhang (Kanch) *＠ Chengdu University of Information Technology 2015 Computer Science Major Mail:kanchisme@gmail.com No.24 Block 1, Xuefu Road, Chengdu, Sichuan, China

### ppartarr commented Mar 13, 2018

 I had this issue as well (Windows 10 & go1.10). The error comes from not setting up your GOPATH in the environment variables See here in the installation docs and [here](https://github.com/golang/go/wiki/SettingGOPATH#windows for setting up your GOPATH). To confirm that you have set up your workspace directory correctly enter the directory using cd path\to\workspace and running go list

### mohanson commented Apr 8, 2018 • edited

 Hello, I know this issue has been closed, but I have encountered the same problem. I found that I cannot compile and run any go code in the OneDrive folder, but when I moved to another path, the problem solved. From go version go1.10.1 windows/amd64 $cd C:\Users\mohan\OneDrive\sandbox && go run run.go package main: cannot find package "." in: C:\Users\mohan\OneDrive\sandbox$ cp run.go C:\\tmp\\run.go && go run C:\\tmp\\run.go Hello World!

### ALTree commented Apr 8, 2018

 @mohanson from the comment above: The error comes from not setting up your GOPATH in the environment variables is GOPATH set in your environment? If not, have you tried setting it?

### mohanson commented Apr 8, 2018

 @ALTree I did not set GOPATH. The Golang automatically creates a new folder named "go" in my user path, so since switch to the v1.10.x I will no longer set it. I just tried set GOPATH=MY_USER_PATH/go, the problem has not been solved.

### mohanson commented Apr 9, 2018

 @ALTree I found Golang doesn't think the Onedrive folder(and any sub folder in it) is a directory, the IsDir() function returns False: package main import ( "log" "os" ) func main() { f, err := os.Open("C:\\Users\\mohan\\OneDrive\\sandbox") if err != nil { log.Fatalln(err) } i, err := f.Stat() if err != nil { log.Fatalln(err) } log.Println(i.IsDir()) // 2018/04/09 11:34:37 false } But in python: python -c "import os.path; print(os.path.isdir('C:\\Users\\mohan\\OneDrive\\sandbox'))" returns True. I think this may be one of the reasons for the problem.
added and removed labels Apr 9, 2018
changed the title package main: cannot find package "." ? What is "." dot package? os: IsDir reports false for OneDrive hosted volumes. Apr 9, 2018
reopened this Apr 9, 2018

### davecheney commented Apr 9, 2018

 /cc @alexbrainman I'm almost certain this is a duplicate of another OneDrive related issue. /cc @jessfraz do you know anyone inside Microsoft who might be able to assist.

### ALTree commented Apr 9, 2018

 #22579 (os: IsDir doesn't work with Windows OneDrive), possibly? If that's the case, it should be fixed on tip (to be go1.11).

### davecheney commented Apr 9, 2018

 Duplicate of #22579 Closing and locking to ensure debate is concentrated on #22579
closed this Apr 9, 2018
locked as resolved and limited conversation to collaborators Apr 9, 2018