MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / ReserveGoPackageAlias

Method ReserveGoPackageAlias

internal/descriptor/registry.go:485–494  ·  view source on GitHub ↗

ReserveGoPackageAlias reserves the unique alias of go package. If succeeded, the alias will be never used for other packages in generated go files. If failed, the alias is already taken by another package, so you need to use another alias for the package in your go files.

(alias, pkgpath string)

Source from the content-addressed store, hash-verified

483// If failed, the alias is already taken by another package, so you need to use another
484// alias for the package in your go files.
485func (r *Registry) ReserveGoPackageAlias(alias, pkgpath string) error {
486 if taken, ok := r.pkgAliases[alias]; ok {
487 if taken == pkgpath {
488 return nil
489 }
490 return fmt.Errorf("package name %s is already taken. Use another alias", alias)
491 }
492 r.pkgAliases[alias] = pkgpath
493 return nil
494}
495
496// GetAllFQMNs returns a list of all FQMNs
497func (r *Registry) GetAllFQMNs() []string {

Callers 3

loadFileMethod · 0.95
NewFunction · 0.80

Calls

no outgoing calls

Tested by 1