Skip to main content

Crate use_go

Crate use_go 

Source
Expand description

§use-go

Feature-gated facade crate for the RustUse Go ecosystem primitives.

§Experimental

use-go is experimental while the workspace remains below 0.3.0. Expect small API adjustments during the first release wave.

§Example

#[cfg(feature = "full")]
use use_go::{GoIdentifier, GoImportPath, GoModulePath, GoPackageName, GoTestName, GoVersion};

#[cfg(feature = "full")]
let version: GoVersion = "go1.22.0".parse()?;
#[cfg(feature = "full")]
let identifier = GoIdentifier::new("ServeHTTP")?;
#[cfg(feature = "full")]
let package = GoPackageName::new("http")?;
#[cfg(feature = "full")]
let import = GoImportPath::new("net/http")?;
#[cfg(feature = "full")]
let module = GoModulePath::new("example.com/project")?;
#[cfg(feature = "full")]
let test = GoTestName::new("TestHandler")?;

#[cfg(feature = "full")]
assert_eq!(version.to_string(), "1.22.0");
#[cfg(feature = "full")]
assert!(identifier.is_exported());
#[cfg(feature = "full")]
assert_eq!(package.as_str(), "http");
#[cfg(feature = "full")]
assert_eq!(import.as_str(), "net/http");
#[cfg(feature = "full")]
assert_eq!(module.as_str(), "example.com/project");
#[cfg(feature = "full")]
assert_eq!(test.as_str(), "TestHandler");

§Scope

  • Opt-in access to the focused Go primitive crates.
  • A small facade surface that avoids implementation logic.
  • Lightweight composition for docs tooling, CLIs, fixtures, and metadata models.

§Non-goals

  • Adding behavior beyond the child crates.
  • Compiling, parsing, formatting, linting, testing, or executing Go code.
  • Resolving Go modules, packages, imports, or workspaces.
  • Shelling out to Go tooling.

§Feature model

The default feature set enables full, which re-exports all focused crates. Disable default features and enable individual features such as version, identifier, module, or go-mod for a narrower dependency surface.

§License

Licensed under either Apache-2.0 or MIT.

Modules§

go_mod
go_work
identifier
import
keyword
module
package
prelude
Curated facade prelude for common Go ecosystem primitives.
test
value
version

Structs§

GoBenchmarkName
GoBoolLiteral
Go bool literal metadata.
GoCompatibilityVersion
Go compatibility version metadata.
GoExampleName
GoExportedIdentifier
Validated exported ASCII-safe Go identifier.
GoFuzzTestName
GoIdentifier
Validated ASCII-safe Go identifier.
GoImportAlias
Validated Go import alias metadata.
GoImportPath
Validated Go import path metadata.
GoImportSpec
Go import specification metadata.
GoMajorVersion
Major component of a Go version.
GoMinorVersion
Minor component of a Go version.
GoModExcludeDirective
exclude directive metadata.
GoModFile
Lightweight go.mod file metadata.
GoModGoDirective
go directive metadata.
GoModModuleDirective
module directive metadata.
GoModReplaceDirective
replace directive metadata.
GoModRequireDirective
require directive metadata.
GoModRetractDirective
retract directive metadata.
GoModToolchainDirective
toolchain directive metadata.
GoModuleDependency
Go module dependency metadata.
GoModulePath
Validated Go module path metadata.
GoModuleReplacement
Go module replacement metadata.
GoModuleRequirement
Go module requirement metadata.
GoModuleVersion
Validated Go module version metadata.
GoNil
Go nil metadata.
GoPackageDocName
Go package documentation name metadata.
GoPackageName
Validated Go package name metadata.
GoPackagePath
Validated slash-separated Go package path metadata.
GoPatchVersion
Patch component of a Go version.
GoPseudoVersion
Validated Go pseudo-version metadata.
GoRuneLiteral
Go rune literal metadata.
GoTestFileName
Validated Go test file-name metadata.
GoTestName
GoToolchainVersion
Go toolchain version metadata.
GoUnexportedIdentifier
Validated unexported ASCII-safe Go identifier.
GoVersion
Parsed Go version metadata.
GoWorkFile
Lightweight go.work file metadata.
GoWorkModulePath
Validated go.work module path metadata.
GoWorkReplaceDirective
replace directive metadata.
GoWorkUseDirective
use directive metadata.

Enums§

GoFileKind
Go file kind metadata.
GoIdentifierError
Error returned when an ASCII Go identifier is invalid.
GoImportError
Error returned by Go import metadata constructors.
GoImportGroup
Go import group metadata.
GoImportKind
Go import kind metadata.
GoKeyword
Go source keywords.
GoKeywordParseError
Error returned when parsing Go vocabulary fails.
GoModConfigFile
go.mod config file kind.
GoModDirective
go.mod directive metadata.
GoModError
Error returned when parsing go.mod metadata labels fails.
GoModuleDirectiveKind
Go module directive kind metadata.
GoModuleError
Error returned by Go module metadata constructors.
GoNumericValue
Primitive numeric Go-like value metadata.
GoPackageError
Error returned by Go package metadata constructors.
GoPackageLayout
Go package layout metadata.
GoPackageVisibility
Go package visibility metadata.
GoPredeclaredIdentifier
Common Go predeclared identifiers.
GoPrimitiveValue
Primitive Go-like value metadata.
GoReservedWord
Go reserved vocabulary: keywords plus common predeclared identifiers.
GoStringLiteralKind
Go string literal kind metadata.
GoTestError
Error returned by Go testing metadata constructors.
GoTestKind
Go test kind metadata.
GoTestOutcome
Go test outcome metadata.
GoTestPackageMode
Go test package mode metadata.
GoValueParseError
Error returned when parsing Go value vocabulary fails.
GoVersionFamily
Go major release family.
GoVersionParseError
Error returned when a Go version label is invalid.
GoWorkConfigFile
go.work config file kind.
GoWorkDirective
go.work directive metadata.
GoWorkError
Error returned by Go workspace metadata constructors.
GoWorkspaceLayout
Go workspace layout metadata.

Functions§

is_ascii_go_identifier_continue
Returns whether character is accepted after the first identifier character.
is_ascii_go_identifier_start
Returns whether character is accepted as an ASCII Go identifier start.
is_exported_go_identifier
Returns whether value is an exported ASCII-safe Go identifier.
is_go_keyword
Returns whether input is a Go keyword.
is_go_predeclared_identifier
Returns whether input is a common Go predeclared identifier.
is_go_reserved_word
Returns whether input is a Go keyword or common predeclared identifier.
is_unexported_go_identifier
Returns whether value is an unexported ASCII-safe Go identifier.
is_valid_ascii_go_identifier
Returns whether value is an ASCII-safe Go identifier.