sdk icon indicating copy to clipboard operation
sdk copied to clipboard

cannot unmarshal object into Go struct field Board.panels of type string

Open kitianFresh opened this issue 3 years ago • 4 comments

func (m *manager) DashboardPanels(ctx context.Context, uid string) ([]*grafanasdk.Panel, error) {
	board, _, err := m.grafanaClient.GetDashboardByUID(ctx, uid)
	if err != nil {
		return nil, err
	}
	return board.Panels, nil
}

So strange, i have checked my dashboard json file, the panels field, it is an array not a string

kitianFresh avatar Jan 18 '22 03:01 kitianFresh

@Yasumoto

kitianFresh avatar Jan 18 '22 04:01 kitianFresh

Would you try #190? I was running into this error and think that it is fixed by the datasource change, even though the error is very confusing.

Go mod replace:

replace github.com/grafana-tools/sdk => github.com/csmarchbanks/sdk v0.0.0-20220120205302-870d00a83f4e

csmarchbanks avatar Jan 20 '22 21:01 csmarchbanks

@csmarchbanks Thanks, it works!

Noksa avatar Jan 27 '22 08:01 Noksa

https://github.com/grafana-tools/sdk/pull/190#issuecomment-1022983930 see my comment here. What do you think? :thinking:

GiedriusS avatar Jan 27 '22 08:01 GiedriusS