When attempting to import to files from the windows file system:
import (
pb "github.com\\sewelol\\sgx-decryption-service\\decryptionservice"
dev "github.com\\sewelol\\sgx-decryption-service\\device"
"google.golang.org\pc"`
)
I get this error
server\main.go:10:5: invalid import path: "github.com\\sewelol\\sgx-decryption-service\\decryptionservice"
I have checked $PATH
enviroment variable includes the directory that has github.com
, and $GOROOT
also is set up to point to the Go installation.
I assume it is something to do with the file paths themselves, but I can't find any information on how to do filepaths in the windows environment.
Thanks
You have to use forward slashes /
in import paths (of import declarations), even if you're on Windows.
Implementation restriction: A compiler may restrict ImportPaths to non-empty strings using only characters belonging to Unicode's L, M, N, P, and S general categories (the Graphic characters without spaces) and may also exclude the characters
!"#$%&'()*,:;<=>?[\]^
{|}` and the Unicode replacement character U+FFFD.
Any compiler may exclude the backslash \
character among others. Even if you would use one that doesn't, your code would not be portable.
So instead try:
import (
pb "github.com/sewelol/sgx-decryption-service/decryptionservice"
dev "github.com/sewelol/sgx-decryption-service/device"
"google.golang.org/rpc"
)