package main import ( "encoding/json" "fmt" "net/http" "os" ) const ( URL = "http://www.omdbapi.com" KEY = "fa22ab55" ) type SearchRes struct { Title string `json:"Title"` Year string `json:"Year"` Genre string `json:"Genre"` Ratings []Ratings } type Ratings struct { Source string `json:"Source"` Value string `json:"Value"` } type Plug any type PlugStruct struct {} func Search(s string) (SearchRes,error) { resp,err := http.Get(URL + "?apikey=" + KEY + "&t=" + s) if err != nil { return SearchRes{},err } var res SearchRes if err := json.NewDecoder(resp.Body).Decode(&res); err != nil { fmt.Print("Error in unmarshalling ",err) } return res,nil } func main() { arg := os.Args[1] // fmt.Println(arg) fmt.Println(Search(arg)) }