Build result in unexpected directory layout

I have go 1.13.6 installed.

Following error upon runninggo test -c -o tester to build test.

unexpected directory layout:
        import path: _/mnt/c/Users/litang/githubWorkSpace/MIT-6.824repo/src/labrpc
        root: /mnt/c/Users/litang/githubWorkSpace/MIT-6.824repo/src
        dir: /mnt/c/Users/litang/githubWorkSpace/MIT-6.824repo/src/labrpc
        expand root: /mnt/c/Users/litang/githubWorkSpace/MIT-6.824repo
        expand dir: /mnt/c/Users/litang/githubWorkSpace/MIT-6.824repo/src/labrpc
        separator: /
ERROR: Build failed

GOPATH is set to /mnt/c/Users/litang/githubWorkSpace/MIT-6.824repo

current working directory is $GOPATH/src/raft

gopath directory structure:

├── Makefile
├── README.md
├── labs
│   ├── lab1
│   │   └── README.md
│   └── lab2
│       └── README.md
├── out2
└── src
    ├── kvraft
    │   ├── client.go
    │   ├── common.go
    │   ├── config.go
    │   ├── server.go
    │   └── test_test.go
    ├── labgob
    │   ├── labgob.go
    │   └── test_test.go
    ├── labrpc
    │   ├── labrpc.go
    │   └── test_test.go
    ├── raft
    │   ├── config.go
    │   ├── go_test_many.sh
    │   ├── loop_to_test_raft.sh
    │   ├── persister.go
    │   ├── raft.go
    │   ├── test_test.go
    │   └── util.go

in raft.go my import as following:

import (
	"bytes"
	"labgob"
	"labrpc"
	"math"
	"math/rand"
	"sync"
	"sync/atomic"
	"time"
)

what should I do to make it right?

As far as I remermber, in GOPATH there is nothing allowed but src, pkg and bin as subfolders.

In general you probably want to update your program to use modules instead of using the legacy GOPATH.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.