I am just wondering which practise below is right way. By the way receiving functions won’t modify the container.
Thanks
type Container struct {
Version string
Shutdown time.Duration
SomeStructA StructA
SomeStructB *StructB
DB *sql.DB
SRV *http.Server
AWSS3 *s3.S3
AWSSES *session.Session
}
func main() {
con := Container{ /* Assume that all fields are populated here */ }
a(con) // Pass by value
// OR
b(&con) // Pass by reference
}
func a(Container) {}
func b(*Container) {}