hello. i have created development setup and for that i am sending my device id over URL so i have write that code in cmd/syncthing/main.go file. then compile it. and before my code i have print static text for test bit not print on console .
so not getting idea what is wrong with compile. i have doubt my code that part is not executing or not compiled in binary.
so any developer can help me ?
Thanks
Below is mine custom code and i want to add when syncthing app open that time generated device id iam sending on my server. so i have added that code in main() function in cmd/syncthing/main.go file but that is not working.
package main
import ( “fmt” “strings” “net/http” “io/ioutil” )
func main() {
url := "http://spare.mydomain.com:8080/"
payload := strings.NewReader("{\"deviceid\":\"12332-23213-sadsaddsasd-asdsad-123213\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("cache-control", "no-cache")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}