scope

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package scope defines the two pseudo visibility levels that declscope layers on top of Go's exported/unexported distinction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scope

type Scope int

Scope is a pseudo visibility level.

Go only distinguishes exported from unexported, which means every unexported package-level identifier is visible to the whole package. Scope narrows that to a namespace, the way an unmodified item is narrow to its module in Rust. The name of a declaration never decides its scope: a directive states it, and the configured default applies otherwise.

There is no public level. Everything is checked within a single package, so a use beyond the package edge is never seen, and a scope that says "visible outside" would name a distinction the analysis cannot make. What is reachable from outside the package is simply not declscope's subject.

const (
	// PackageInternal is visible anywhere in the package — what Go's unexported
	// already means. It is selected with //declscope:package, or by configuring
	// it as the default.
	PackageInternal Scope = iota

	// Private is visible only within its own namespace. It is the default.
	Private
)

func Parse

func Parse(keyword string) (Scope, bool)

Parse resolves a directive keyword to its scope.

func (Scope) Directive

func (s Scope) Directive() string

Directive returns the comment directive that selects s explicitly.

func (Scope) String

func (s Scope) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL