Skip to content

Commit 9d2aff9

Browse files
Correcting the struct according to the response from the API
The existing documentation is failing to get the published date with the current format of struct. Here is the error seen while printing the date. .\news-test.go:94:42: result.DatePublished undefined (type struct { Name string "json: \"name\""; URL string "json: \"url\""; Image struct { Thumbnail struct { ContentUrl string "json: \"thumbnail\""; Width int "json: \"width\""; Height int "json: \"height\"" } "json: \"thumbnail\""; Description string "json: \"description\""; Provider []struct { Type string "json: \"_type\""; Name string "json: \"name\"" } "json: \"provider\""; DatePublished string "json: \"datePublished\"" } "json: \"image\"" } has no field or method DatePublished) ------- cc: @aahill GitHub Issue: https://github.com/MicrosoftDocs/azure-docs/issues/50544
1 parent a6d0918 commit 9d2aff9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

articles/cognitive-services/Bing-News-Search/go.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ type NewsAnswer struct {
6969
Width int `json: "width"`
7070
Height int `json: "height"`
7171
} `json: "thumbnail"`
72+
} `json: "image"`
7273
Description string `json: "description"`
7374
Provider []struct {
7475
Type string `json: "_type"`
7576
Name string `json: "name"`
7677
} `json: "provider"`
7778
DatePublished string `json: "datePublished"`
78-
} `json: "image"`
7979
} `json: "value"`
8080
}
8181

0 commit comments

Comments
 (0)