read file in golang

pwd, _ := os.Getwd()
jsonFile, err := ioutil.ReadFile(pwd + "/fakeFundDataJson.json")

if err != nil {
   fmt.Println(err)
}
fmt.Println("Successfully Opened users.json")

w.Write(jsonFile)
w.WriteHeader(http.StatusOK)
w.Header().Add("Content-type", "application/json")

Comments

Popular posts from this blog

Fixing the DeepSpeed Import Error While Fine-Tuning the Qwen Model

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

How to create ISM policy and rotate logs in opensearch