Home >Backend Development >Golang >Which Packages Can I Import in the Go Playground?
When working with the Go Playground at http://play.golang.org, users may encounter a limited ability to import certain packages. This guide aims to clarify which packages are admissible within the Playground environment and provide a solution to accommodate experimental and supplemental libraries.
The Playground imposes specific restrictions on importable packages:
The Playground allows importing selected non-standard packages:
To avoid import errors in the Playground:
For non-standard packages not meeting the base package criteria or not explicitly allowed in the Playground, alternative options include:
You can test the Playground's ability to import standard library packages with the following code:
package main import ( // Imports all standard library packages. _ "archive/tar" _ "archive/zip" _ "bufio" _ "bytes" // ... (Continues through the entire standard library, add as many packages as needed.) ) func main() { println("ok") }
Note that despite the exhaustive import list, not all packages can be effectively utilized due to limitations within the Playground environment.
The above is the detailed content of Which Packages Can I Import in the Go Playground?. For more information, please follow other related articles on the PHP Chinese website!