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

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

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

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

ankanch opened this issue Oct 25, 2017 · 22 comments
Labels

Comments

@ankanch
Copy link

@ankanch ankanch commented Oct 25, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.1 windows/amd64

Does this issue reproduce with the latest release?

YES

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

  • amd64
  • Windows 10 Pro
    qq 20171025231335

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
Copy link
Member

@ALTree ALTree commented Oct 25, 2017

What command did you run? And where did you run it? And where is the code you posted located (filename and path)?

@ankanch
Copy link
Author

@ankanch ankanch commented Oct 25, 2017

@ALTree
Copy link
Member

@ALTree 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.

@ALTree ALTree closed this Oct 25, 2017
@heschik
Copy link
Contributor

@heschik heschik commented Oct 25, 2017

I hope that's not your password, but if it is, you should change it quick :(

@ankanch
Copy link
Author

@ankanch 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")
}

qq 20171026074119

@alexbrainman
Copy link
Member

@alexbrainman 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
Copy link
Author

@ankanch ankanch commented Oct 26, 2017

Here's my result:

qq 20171026101705

The error message is the same, that "." package cannot be found.

@alexbrainman
Copy link
Member

@alexbrainman 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
Copy link
Author

@ankanch ankanch commented Oct 26, 2017

image

@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
Copy link
Contributor

@davecheney davecheney commented Oct 26, 2017

@ankanch
Copy link
Author

@ankanch ankanch commented Oct 26, 2017

@davecheney
Copy link
Contributor

@davecheney davecheney commented Oct 26, 2017

@reza7rm
Copy link

@reza7rm reza7rm commented Nov 16, 2017

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

@ankanch
Copy link
Author

@ankanch ankanch commented Nov 16, 2017

@ppartarr
Copy link

@ppartarr 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
Copy link

@mohanson mohanson commented Apr 8, 2018

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
Copy link
Member

@ALTree 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
Copy link

@mohanson 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
Copy link

@mohanson 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.

@davecheney davecheney added OS-Windows and removed WaitingForInfo labels Apr 9, 2018
@davecheney davecheney changed the title package main: cannot find package "." ? What is "." dot package? os: IsDir reports false for OneDrive hosted volumes. Apr 9, 2018
@davecheney davecheney reopened this Apr 9, 2018
@davecheney
Copy link
Contributor

@davecheney 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
Copy link
Member

@ALTree 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
Copy link
Contributor

@davecheney davecheney commented Apr 9, 2018

Duplicate of #22579

Closing and locking to ensure debate is concentrated on #22579

@davecheney davecheney closed this Apr 9, 2018
@golang golang locked as resolved and limited conversation to collaborators Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.