brandon
(wheely)
March 18, 2022, 6:14pm
1
How do I import a package without a GOROOT set?
I have a directory structure like this.
tempconv/
├── main.go
└── mypackage.go
I am getting the error
archlinux $ go run main.go
main.go:5:5: package tempconv is not in GOROOT (/usr/local/go/src/tempconv)
The tempconv directory is is /home/$USER/bin/go/
.
Will I have to move all the code to /usr/local/go/src/
?
NobbZ
(Norbert Melzer)
March 18, 2022, 6:42pm
2
Idiomatically you make it a proper module, less idiomatically you start a legacy project using GOPATH
which would still require moving your files around, but at least within user writable location.
1 Like
system
(system)
Closed
June 16, 2022, 7:02pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.