Golang : package is not in GOROOT during compilation
Alright, just putting down here for my own future reference, in case of future encounter with this weird error message during compilation process.
package xxx is not in GOROOT
Basically the problem is caused by go modules. To fix this problem, first check your Golang's environment with go env
to see if GO111MODULE=on
If yes, then set it to OFF.
If you're using a build script to compile your code. Remember to SET GO111MODULE=off
Before compiling, best to clean up the module cache by issuing this command.
go clean --modcache
Hope this helps and happy coding!
Reference :
https://dev.to/maelvls/why-is-go111module-everywhere-and-everything-about-go-modules-24k
See also : Golang : How to solve "too many .rsrc sections" error?
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+5k Golang : Find the length of big.Int variable example
+8.2k Golang : zlib compress file example
+2.6k Javascript : Access JSON data example
+4k Javascript : Get operating system and browser information
+6.3k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+6.8k Golang : Text file editor (accept input from screen and save to file)
+10.5k Golang : On enumeration
+11.3k Golang : Check if a file exist or not
+10.7k Golang : GUI with Qt and OpenCV to capture image from camera
+3.7k Golang : Selection sort example
+5.1k Golang : Scan files for certain pattern and rename part of the files
+7.8k RPM : error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery