func readAuthConfig(path string) *authData.AuthData { asciiConfig := util.ReadFileOrDie(path) protoConfig := &authData.AuthData{} err := proto.UnmarshalText(string(asciiConfig), protoConfig) if err != nil { log.Fatal("Cannot parse config: ", err) } return protoConfig }
// tryParse attempts to parse the input, and verifies that it matches // the FileDescriptorProto represented in text format. func tryParse(t *testing.T, input, output string) { expected := new(FileDescriptorProto) if err := proto.UnmarshalText(output, expected); err != nil { t.Fatalf("Test failure parsing an expected proto: %v", err) } actual := new(FileDescriptorProto) p := newParser(input) if pe := p.readFile(actual); pe != nil { t.Errorf("Failed parsing input: %v", pe) return } if !reflect.DeepEqual(expected, actual) { t.Errorf("Mismatch! Expected:\n%v\nActual\n%v", proto.CompactTextString(expected), proto.CompactTextString(actual)) } }