I have a package main
in which there are 2 files:
- main.go
- api.go
In file main.go
in main function
I use findPetByID function
...
r.HandleFunc("/pet/{petId}", findPetByID).Methods("GET")
...
And in api.go
file I declared a function findPetByID
.
Both files declared in main package and VSCode sees no problem with it because there is no warnings and IDE is able to see function signature from the main fuction i.e. findPetByID func(w http.ResponseWriter, r *http.Request)
.
But when I start it then the ide shows me
# command-line-arguments .\main.go:133:31: undefined: findPetByID
What is wrong with it?