Run separate folders in main folder in golang

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

}

What does work mean?

What’s the implementation of the called functions?

how do i run two functions i need this

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()

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.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.