diff --git a/go/google/fhir/jsonformat/internal/protopath/proto_path.go b/go/google/fhir/jsonformat/internal/protopath/proto_path.go index 6d9e418d3..282b4f401 100644 --- a/go/google/fhir/jsonformat/internal/protopath/proto_path.go +++ b/go/google/fhir/jsonformat/internal/protopath/proto_path.go @@ -85,18 +85,6 @@ func (p Path) String() string { return strings.Join(strParts, ".") } -// NewPath creates a Path from a string definition using Go field names. -// -// Deprecated: Opaque protos will break this indexing Go proto structs by field -// name. Please use NewProtoPath instead. -func NewPath(p string) Path { - path := Path{} - for _, part := range strings.Split(p, ".") { - path.parts = append(path.parts, goPathPart(part)) - } - return path -} - // NewProtoPath creates a Path from a string definition using proto field names. func NewProtoPath(p string) Path { path := Path{} @@ -592,16 +580,3 @@ func Get(m proto.Message, path Path, defVal interface{}) (interface{}, error) { } return get(m.ProtoReflect(), defVal, path.parts) } - -// GetString retrieves a string value from a proto at `path`, or returns an -// empty string. An error will occur if the path is invalid. -// -// Deprecated: use Get and cast the result yourself. -func GetString(m protov1.Message, path Path) (string, error) { - v, err := Get(protov1.MessageV2(m), path, "") - if err != nil { - return "", err - } - // Cannot panic because we've already checked that the value is a string. - return v.(string), nil -} diff --git a/go/google/fhir/jsonformat/internal/protopath/proto_path_test.go b/go/google/fhir/jsonformat/internal/protopath/proto_path_test.go index 7c3970219..b5a53ac98 100644 --- a/go/google/fhir/jsonformat/internal/protopath/proto_path_test.go +++ b/go/google/fhir/jsonformat/internal/protopath/proto_path_test.go @@ -603,23 +603,6 @@ func TestGet_Errors(t *testing.T) { } } -func TestGetString(t *testing.T) { - msg := &rfpb.Account{} - path := NewProtoPath("meta.id.value") - v, err := GetString(msg, path) - if err != nil { - t.Fatalf("GetString(%v, %v) got error %v, expected ", msg, path, err) - } - if v != "" { - t.Fatalf(`GetString(%v, %v) got %v, expected ""`, msg, path, v) - } - - path = NewProtoPath("foo") - if _, err := GetString(msg, path); err == nil { - t.Fatalf("GetString(%v, %v) got error , expected error", msg, path) - } -} - func TestString(t *testing.T) { tests := []string{ "normal",