I create two api service providers with Golang and run these api’s in the main.go file, whichever function is on top works. The sub function does not work. What should I do to get the two functions to work?
go.mod:
module gom
go 1.19
start/main.go:
package main
import (
"gom/blog"
"gom/email"
)
func main() {
blog.Blog()
email.SendMail()
}
blog/blog.go:
package blog
func Blog(){
//code
}
email/email.go:
package email
func SendEmail(){
//code
}
NobbZ
(Norbert Melzer)
March 7, 2023, 5:29pm
2
What does work mean?
What’s the implementation of the called functions?
how do i run two functions i need this
mje
(Jeff Emanuel)
March 7, 2023, 5:57pm
4
Your functions likely do not return. Run them asynchronously in new go routines.
go email.SendEmail()
// no go for the last function because the main goroutine will end the process will exit.
blog.Blog()
NobbZ
(Norbert Melzer)
March 7, 2023, 6:06pm
5
Again, what exactly do my mean with “only the first function works”?
And what would be the implementation of those functions?
Assuming both functions return, I would expect them to be called sequentially.
system
(system)
Closed
June 5, 2023, 6:14pm
7
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.