What is golang.org/x namespace?

1.3k views Asked by At

I know to import a package, we could use

import (
        "golang.org/x/text"
)

I have a question about the golang.org/x? Is this the namespace for all standard libraries to live? How does this namespace play in the go ecosystem?

Thanks.

1

There are 1 answers

0
Juanito Fatas On

From the mailing list thread, it looks like the import path, golang.org/x, was introduced for sub-repositories packages in Go 1.4:

These packages are part of the Go Project but outside the main Go tree. They are developed under looser compatibility requirements than the Go core. Install them with "go get".

The x means eXternal to standard libraries.

So golang.org/x is the import path for sub-repositories packages.

  • import "net/http" (Standard Library)
  • import "golang.org/x/text" (Library in sub-repository)