Skip to content

RustUse/use-go

RustUse/use-go

Composable Go ecosystem primitives for RustUse.

use-go is a focused RustUse set for representing Go language, package, import, module, go.mod, go.work, and test metadata as small Rust primitives. It is not a Go compiler, parser, formatter, linter, package manager, module resolver, test runner, project generator, or Go toolchain wrapper.

Workspace crates

Crate Path Purpose
use-go crates/use-go/ Facade over the focused Go ecosystem crates
use-go-version crates/use-go-version/ Go version and toolchain primitives
use-go-identifier crates/use-go-identifier/ ASCII-safe Go identifier validation
use-go-keyword crates/use-go-keyword/ Go keyword and predeclared identifier labels
use-go-value crates/use-go-value/ Go-like primitive value metadata
use-go-package crates/use-go-package/ Go package metadata primitives
use-go-import crates/use-go-import/ Go import metadata primitives
use-go-module crates/use-go-module/ Go module path, version, and dependency data
use-go-mod crates/use-go-mod/ go.mod metadata primitives
use-go-work crates/use-go-work/ go.work metadata primitives
use-go-test crates/use-go-test/ Go testing metadata primitives

Experimental

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

Example

use use_go::{GoIdentifier, GoImportPath, GoModulePath, GoPackageName, GoTestName, GoVersion};

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

assert_eq!(version.to_string(), "1.22.0");
assert!(identifier.is_exported());
assert_eq!(package.as_str(), "http");
assert_eq!(import.as_str(), "net/http");
assert_eq!(module.as_str(), "example.com/project");
assert_eq!(test.as_str(), "TestHandler");
# Ok::<(), Box<dyn std::error::Error>>(())

Scope

  • Small, dependency-light Rust primitives for Go ecosystem concepts.
  • Lightweight validation for names, labels, versions, paths, directives, and metadata shapes.
  • Facade access through use-go plus narrow focused crates for direct use.

Non-goals

  • Compiling, parsing, formatting, linting, or executing Go code.
  • Running go, gofmt, go test, go mod, go work, or related tools.
  • Resolving packages, imports, modules, workspaces, registries, module proxies, or test files.
  • Generating Go projects or replacing the Go toolchain.
  • Depending on heavy parser, compiler, runtime, or package manager crates.

Feature model

The use-go facade defaults to full, which re-exports every focused crate. Consumers can disable defaults and enable only the child crate features they need.

Development

cargo fmt --all -- --check
cargo check --workspace --all-features
cargo check --workspace --all-features --examples
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
cargo test --workspace --no-default-features

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors