I am working on a project in Go. For organization, I have code divided into files:
- server-related functions go to server.go
- data processing in db.go
- global variables are in types.go
- and etc.
I declared the document_root variable in types.go and defined it in main.go with:
document_root,error := config.GetString("server","document_root")
In server.go, I have a function to generate an HTTP status code for the requested file, and it does the following:
_, err := os.Stat(document_root+"/"+filename);
When compiling, I get this error:
"document_root declared and not used"
What am I doing wrong?
source share