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

path/filepath: filepath.Walk does not work on mounted volumes in Windows containers #26033

buddyspike opened this issue Jun 24, 2018 · 2 comments


Copy link

@buddyspike buddyspike commented Jun 24, 2018

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


Does this issue reproduce with the latest release?

Not sure

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

windows 386

What did you do?

  • Cross compile the following program from osx GOOS=windows GOARCH=386 go build -o walk.exe main.go (cross compilation does not really matter, the behaviour outlined below is also consistent even if the binary is produced in a windows)

  • Created a docker container from microsoft/windowsservercore

docker run --rm -it -v c:\files:c:\files microsoft/windowsservercore
  • Ran the program on the mounted volume
walk.exe -path c:\files
package main

import (

func main() {
	path := flag.String("path", "", "path to walk")
	fmt.Printf("walking path %v\n", *path)

	err := filepath.Walk(*path, func(path string, info os.FileInfo, err error) error {
		if err != nil {
		fmt.Printf("visiting %v\n", path)
		return nil

	if err != nil {

What did you expect to see?

List of files and directories in c:\files.

What did you see instead?

Just the root directory


This comment has been minimized.

Copy link

@slrz slrz commented Jun 24, 2018

You run the walk program outside of the started container, just on the same directory that is also mounted into the container?

The directory search works ok when using other (non-Go) programs? Can you check what this C program would output?

@namusyaka namusyaka changed the title filepath.Walk does not work on mounted volumes in Windows containers path/filepath: filepath.Walk does not work on mounted volumes in Windows containers Jun 24, 2018
@FiloSottile FiloSottile modified the milestones: Go1.12, Go1.11 Jun 26, 2018

This comment has been minimized.

Copy link

@buddyspike buddyspike commented Jun 26, 2018

Sorry about the lag in my response. Program is run from the default CWD inside the container. However it's in a mounted directory. To be precise:

Step 1 - Launch the container. c:\files has the items we want to traverse. c:\bin has walk.exe.

docker run --rm -it -v c:\files:c:\files -v c:\bin:c:\bin microsoft/windowsservercore

Step 2 - From cwd, run walk.exe

c:\bin\walk.exe -path c:\files

Using other programs such as dir works just fine on mounted directories.
I will update this thread the with the result of the above program over the next couple of days.

Hopefully this clarifies the situation a bit further.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jun 27, 2018
@ianlancetaylor ianlancetaylor modified the milestones: Go1.12, Go1.13 Dec 21, 2018
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
7 participants
You can’t perform that action at this time.