Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structs Source && Sync have unexported field #27

Open
drdeimos opened this issue Sep 2, 2023 · 0 comments
Open

Structs Source && Sync have unexported field #27

drdeimos opened this issue Sep 2, 2023 · 0 comments

Comments

@drdeimos
Copy link

drdeimos commented Sep 2, 2023

Hi. Why this struct fields leave unexported?

pulse/source.go

Lines 5 to 8 in 75628da

// A Source is an input device.
type Source struct {
info proto.GetSourceInfoReply
}

pulse/sink.go

Lines 5 to 8 in 75628da

// A Sink is an output device.
type Sink struct {
info proto.GetSinkInfoReply
}

For i.e. i want get sink properties like this:

func main() {

  client, err := pulse.NewClient()
  defer client.Close()
  sources, err := client.ListSources()
....
  for _, source := range sources {
		if isBluetoothDevice(client, source) {
			fmt.Printf("device name: %s", source.Name)
			fmt.Println("----------")
		}
    }
} 
func isBluetoothDevice(device interface{}) bool {
	switch device := device.(type) {
	case *pulse.Source:
		_, ok := device.Properties["device.api"]
		if device.(pulse.Source).info.Properties["device.api"] == "bluez"
			return true
		.....
	default:
		return false
	}
}

But field info unexported 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant