Dieser Code funktioniert:Aufruf struct Methode
feedService := postgres.FeedService{}
feeds, err := feedService.GetAllRssFeeds()
Aber dieser Code gibt mir Fehler:
feeds, err = postgres.FeedService{}.GetAllRssFeeds()
controllers\feed_controller.go:35: cannot call pointer method on postgres.FeedService literal controllers\feed_controller.go:35: cannot take the address of postgres.FeedService literal
Warum diese beiden Teile des Codes nicht gleich?
Hier ist eine Strukturdeklaration:
type FeedService struct {
}
func (s *FeedService) GetAllRssFeeds() ([]*quzx.RssFeed, error) {
"Warum diese zwei Teile des Codes nicht gleich sind?" weil die Sprachspezifikation das sagt. Die Fehlermeldung ist ziemlich selbsterklärend, oder? – Volker