I am developing a personal project in Golang, using libtorrent-go
When I do receive an alert of type "save_resume_data_alert", I pick it up and have to CAST it as written in libtorrent documentation
...
        save_resume_data_alert const* rd = alert_cast<save_resume_data_alert>(a);
...
But i really have not idea how to cast it in golang! Current code:
package main
import (
    lt "github.com/steeve/libtorrent-go"
    "log"
    "time"
)
func main() {
    randomTorrent := lt.NewAdd_torrent_params()
    randomTorrent.SetUrl("PUT A MAGNET LINK HERE")
    randomTorrent.SetSave_path(".")
    ec := lt.NewError_code()
    torrentSession := lt.NewSession()
    torrentSession.Set_alert_mask(status_notification + storage_notification)
    torrentSession.Listen_on(lt.NewStd_pair_int_int(6900, 6999), ec)
    if ec.Value() != 0 {
        log.Println(ec.Message())
    }
    torrentHandle := torrentSession.Add_torrent(randomTorrent, ec)
    if ec.Value() != 0 {
        log.Println(ec.Message())
    }
    go func() {
        for {
            if torrentSession.Wait_for_alert(lt.Seconds(10)).Swigcptr() == 0 {
                log.Println("Alert timeout occurred!")
            }
            alert := torrentSession.Pop_alert()
            switch alert.What() {
            default:
                log.Printf("Alert: %#v", alert.What())
            case "metadata_received_alert":
                log.Println("Received Metadata!! finally!")
                torrentHandle.Save_resume_data()
            case "save_resume_data_alert":
                log.Println("Wrote Metadata!")
                // need to actually write the resume_data :( can't find how
            case "save_resume_data_failed_alert":
                log.Println("Failed Metadata!")
            }
        }
    }()
    select {}
}
				
                        
As stated above,
libtorrent-godeveloper answered me, so I am forwarding the answer for posterity reasons.Casting C++ structures in Golang using SWIG library is documented in SWIG-Golang documentation.
In particular in this statement:
In that particular piece of code I posted above, the following was necessary to make it work: