Why are some golang.org package names prefixed with an x
? The specific package that piqued my interest was bycrypt
My main concern is the x
means something like eXperimental, and I should use a different set of libraries if I want something stable. If not that, the x
is there to signify something -- I'm curious what it is.
The x means eXternal to standard libraries. So golang.org/x is the import path for sub-repositories packages.
Package names should be lowercase. Don't use snake_case or camelCase in package names. The Go blog has a comprehensive guide about naming packages with a good variety of examples.
As we discussed, there are two types of packages. An executable package and a utility package.
Go programs are organized into packages. A package is a collection of source files in the same directory that are compiled together. Functions, types, variables, and constants defined in one source file are visible to all other source files within the same package.
The x
means external. They are developed outside of the golang core. Experimental packages are under golang.org/x/exp
Refs: https://golang.org/pkg/#subrepo https://groups.google.com/forum/#!msg/golang-nuts/eD8dh3T9yyA/l5Ail-xfMiAJ
Packages that are prefixed with X are part of the go project but are stored in sub repos. They are not experimental.
See: https://golang.org/pkg/#subrepo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With