MCPcopy
hub / github.com/golang/protobuf / baseName

Function baseName

protoc-gen-go/generator/generator.go:2748–2758  ·  view source on GitHub ↗

baseName returns the last path element of the name, with the last dotted suffix removed.

(name string)

Source from the content-addressed store, hash-verified

2746
2747// baseName returns the last path element of the name, with the last dotted suffix removed.
2748func baseName(name string) string {
2749 // First, find the last element
2750 if i := strings.LastIndex(name, "/"); i >= 0 {
2751 name = name[i+1:]
2752 }
2753 // Now drop the suffix
2754 if i := strings.LastIndex(name, "."); i >= 0 {
2755 name = name[0:i]
2756 }
2757 return name
2758}
2759
2760// The SourceCodeInfo message describes the location of elements of a parsed
2761// .proto file by way of a "path", which is a sequence of integers that

Callers 2

GoPackageNameMethod · 0.85
SetPackageNamesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected