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
+5.2k Golang : Generate Interleaved 2 inch by 5 inch barcode
+31k Golang : Calculate percentage change of two values
+23.8k Golang : Use regular expression to validate domain name
+4.6k JavaScript : Rounding number to decimal formats to display currency
+33.7k Golang : convert(cast) bytes to string
+8.4k PHP : How to parse ElasticSearch JSON ?
+13.7k Generate salted password with OpenSSL example
+19.2k Golang : Get RGBA values of each image pixel
+8.5k Golang : Add text to image and get OpenCV's X, Y co-ordinates example
+11.4k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+30.8k Golang : Interpolating or substituting variables in string examples
+6k Java : Human readable password generator