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§
- GoBenchmark
Name - GoBool
Literal - Go bool literal metadata.
- GoCompatibility
Version - Go compatibility version metadata.
- GoExample
Name - GoExported
Identifier - Validated exported ASCII-safe Go identifier.
- GoFuzz
Test Name - GoIdentifier
- Validated ASCII-safe Go identifier.
- GoImport
Alias - Validated Go import alias metadata.
- GoImport
Path - Validated Go import path metadata.
- GoImport
Spec - Go import specification metadata.
- GoMajor
Version - Major component of a Go version.
- GoMinor
Version - Minor component of a Go version.
- GoMod
Exclude Directive excludedirective metadata.- GoMod
File - Lightweight
go.modfile metadata. - GoMod
GoDirective godirective metadata.- GoMod
Module Directive moduledirective metadata.- GoMod
Replace Directive replacedirective metadata.- GoMod
Require Directive requiredirective metadata.- GoMod
Retract Directive retractdirective metadata.- GoMod
Toolchain Directive toolchaindirective metadata.- GoModule
Dependency - Go module dependency metadata.
- GoModule
Path - Validated Go module path metadata.
- GoModule
Replacement - Go module replacement metadata.
- GoModule
Requirement - Go module requirement metadata.
- GoModule
Version - Validated Go module version metadata.
- GoNil
- Go nil metadata.
- GoPackage
DocName - Go package documentation name metadata.
- GoPackage
Name - Validated Go package name metadata.
- GoPackage
Path - Validated slash-separated Go package path metadata.
- GoPatch
Version - Patch component of a Go version.
- GoPseudo
Version - Validated Go pseudo-version metadata.
- GoRune
Literal - Go rune literal metadata.
- GoTest
File Name - Validated Go test file-name metadata.
- GoTest
Name - GoToolchain
Version - Go toolchain version metadata.
- GoUnexported
Identifier - Validated unexported ASCII-safe Go identifier.
- GoVersion
- Parsed Go version metadata.
- GoWork
File - Lightweight
go.workfile metadata. - GoWork
Module Path - Validated
go.workmodule path metadata. - GoWork
Replace Directive replacedirective metadata.- GoWork
UseDirective usedirective metadata.
Enums§
- GoFile
Kind - Go file kind metadata.
- GoIdentifier
Error - Error returned when an ASCII Go identifier is invalid.
- GoImport
Error - Error returned by Go import metadata constructors.
- GoImport
Group - Go import group metadata.
- GoImport
Kind - Go import kind metadata.
- GoKeyword
- Go source keywords.
- GoKeyword
Parse Error - Error returned when parsing Go vocabulary fails.
- GoMod
Config File go.modconfig file kind.- GoMod
Directive go.moddirective metadata.- GoMod
Error - Error returned when parsing
go.modmetadata labels fails. - GoModule
Directive Kind - Go module directive kind metadata.
- GoModule
Error - Error returned by Go module metadata constructors.
- GoNumeric
Value - Primitive numeric Go-like value metadata.
- GoPackage
Error - Error returned by Go package metadata constructors.
- GoPackage
Layout - Go package layout metadata.
- GoPackage
Visibility - Go package visibility metadata.
- GoPredeclared
Identifier - Common Go predeclared identifiers.
- GoPrimitive
Value - Primitive Go-like value metadata.
- GoReserved
Word - Go reserved vocabulary: keywords plus common predeclared identifiers.
- GoString
Literal Kind - Go string literal kind metadata.
- GoTest
Error - Error returned by Go testing metadata constructors.
- GoTest
Kind - Go test kind metadata.
- GoTest
Outcome - Go test outcome metadata.
- GoTest
Package Mode - Go test package mode metadata.
- GoValue
Parse Error - Error returned when parsing Go value vocabulary fails.
- GoVersion
Family - Go major release family.
- GoVersion
Parse Error - Error returned when a Go version label is invalid.
- GoWork
Config File go.workconfig file kind.- GoWork
Directive go.workdirective metadata.- GoWork
Error - Error returned by Go workspace metadata constructors.
- GoWorkspace
Layout - Go workspace layout metadata.
Functions§
- is_
ascii_ go_ identifier_ continue - Returns whether
characteris accepted after the first identifier character. - is_
ascii_ go_ identifier_ start - Returns whether
characteris accepted as an ASCII Go identifier start. - is_
exported_ go_ identifier - Returns whether
valueis an exported ASCII-safe Go identifier. - is_
go_ keyword - Returns whether
inputis a Go keyword. - is_
go_ predeclared_ identifier - Returns whether
inputis a common Go predeclared identifier. - is_
go_ reserved_ word - Returns whether
inputis a Go keyword or common predeclared identifier. - is_
unexported_ go_ identifier - Returns whether
valueis an unexported ASCII-safe Go identifier. - is_
valid_ ascii_ go_ identifier - Returns whether
valueis an ASCII-safe Go identifier.