I have go script main.go which I am calling it from shell script. main.go returns the response as below on success. I am looking to capture the return response in a variable from the same shell script I am calling main.go
Response from running go run main.go
No content to read in :/labs/text/11/004/11-004_M0_1_arm_1.d78d350eef91f1e72d801e064a088cf80d3c840a-0023.txt
2023/07/13 04:46:52 /app/lab-processor/src/main.go:201 SLOW SQL >= 200ms
[1267.568ms] [rows:1] SELECT * FROM "pipeline1_2"."p_doc_pp_dates" WHERE filename LIKE '%11-004_M0_1_arm_1.d78d350eef91f1e72d801e064a088cf80d3c840a%' AND pagenumber = 38 ORDER BY begin desc LIMIT 1
First response is when ran first file where there is no content to read and second response in when there is something in the file and it loaded in the table
I have tried something like
go run main.go > return_resp
echo $return_resp
however it was not much of help